Problems trying to boot from SPIFI (Non supported dev board)

Comments

5 comments

  • Avatar
    Michael Johnson

    Could you create a project for the lpc4330 explorer board.

    0
    Comment actions Permalink
  • Avatar
    Luisfranciscor

    Hi Michael, yes... if I use the LPC4330 Xplorer wizard the project works fine! But I'm just trying to figure out the steps needed to start my project from the generic LPC4300 wizard! Currently I'm having a look at the SPIFI_Loader project to try to understand how it works! more exactly to try to understand why I need to put the board in DFU mode! (as a hobbyist I'm not required to understand this but I think is a good way to learn more about Cortex-M MCUs)

    Thanks

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    This maybe a problem with the reset script of the lpc4300

    Try adding the following to the top of the ResetCM4() function in LPC4300_Target.js

    function ResetCM4()
    {
          TargetInterface.resetAndStop(100);
          return;
     }

    and see if this helps.

    Regards

    Michael

    0
    Comment actions Permalink
  • Avatar
    Luisfranciscor

    I modified the ResetCM4() function as per your suggestion but unfortunately it didn't work! (importing LPC4300_Target.js before edited)

    The good news is that using a Diff tool I managed to figure out what I was missing and got a working project for my bambino board  based on generic LPC4300 wizard. This is the procedure:

    1.- Create a new project and select the template "An executable for NXP LPC4300", typed project name and location folder as required.

    2.- On the "common project settings" changed the "Target Processor" to LPC4330 and click on finish

    3.- On the project's properties windows I set the "section placement" to "SPIFI", and add the definition "SPIFI_SIZE=0x800000" to "Memory Map Macros" field (under Build Options). Then I close Crossstudio saving all changes.

    4.- Then using Notepad++ I edited the project .hzp file and added the following piece of xml at the end of the file, just above the item "Flash" or before the line "</solution>"

     

    <configuration
          Name="SPIFI"
          arm_target_flash_loader_file_path="$(TargetsDir)/NGX_LPC4330_Xplorer/Release/SPIFI_Loader.elf"
          arm_target_flash_loader_type="LIBMEM RPC Loader"
          arm_target_loader_can_lock_all="No"
          arm_target_loader_can_lock_range="No"
          arm_target_loader_can_unlock_all="No"
          arm_target_loader_can_unlock_range="No"
          arm_target_loader_reset_after_download="No"
          hidden="Yes"
          target_loader_reset_script="SPIFIReset(4)" />

    5.- Open the project in crossstudio again and replace the content of LPC4300_Target.js with the content of NGX_LPC4330_Xplorer_Target.js (the later pulls the former)

    6.- Add some code to blink one of the board's leds and... Voila!

     

    Examining the mcu registers (program counter) and disassembly windows I can see that the program is running in the 0x14000xxx memory range which correspond to SPIFI range on the LPC43xx MCU family... so I assume that the binary was flashed to the external spifi memory!Unfortunately this is not case because after I power-cycle the board the led work blink anymore... in fact the board seem to be dead!

    To be sure I created another project using the "NGX LPC4330 Xplorer" template, added the code to blink the led and got same behavior... it works while debugging but stop working when the board is powered on in normal mode (No DFU and no debug adapter)

     

    I also used the "Verify Elf File..." option to check the content of SPIFI memory and got the message "Verifier has found no errors" with both projects.

    Regards

     

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    You'll  need to set the PP define STARTUP_FROM_RESET to allow the program to startup. Only do this to programs that you know work or you can change the boot source of the micro.

    0
    Comment actions Permalink

Please sign in to leave a comment.