Use blhost to program/erase LPC54(S)0xx flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use blhost to program/erase LPC54(S)0xx flash

Use blhost to program/erase LPC54(S)0xx flash

Note: This document provides a simple description, the details about flashloader can be found at Getting Started with LPC540xx Flashloader User's Guide.pdf which is located in SDK_2.5.0_LPCXpresso54S018\middleware\mcu-boot\doc

 

  • Download LPC54S0xx SDK.

 

  • Compile the flashloader project to generate flashloader.bin
    •  The project is located in sdk\boards \lpcxpresso54s018\bootloader_examples\flashloader

 

  • Use dfu-util.exe or IDE to load flashloader.bin into RAM.
    • dfu-util can be downloaded from http://dfu-util.sourceforge.net/releases/
    • Configure the ISP pins and then reset the chip to make the chip to enter USB1 DFU boot mode.
    • Boot mode

      ISP2

      PIO0_6 pin

      ISP1

      PIO0_5 pin

      ISP0

      PIO0_4 pin

      Description

      USB1 DFU boot

      LOW LOW HIGH

      USB DFU class is used to download image over the USB1 high-speed port into SRAM.

    • Connect the LPC54S0xx device USB1 high-speed port and PC with USB. The following is the command line to load the flashloader.bin:

$ dfu-util.exe –D flashloader.bin

 

  • Use blhost to program/erase LPC540xxM/LPC54S0xxM flash
    • Once the flashloader binary is downloaded and starts its execution on the LPC54S0xx platform and there remains a physical USB connection between the LPC54S0xx platform USB1(High-Speed) and host, the flashloader will be ready to receive the commands.

    • blhost -u 0x1fc9,0x01a2 -- get-property 12
    • blhost -u 0x1fc9,0x01a2 -- fill-memory 0x2000d000 4 0xc0000004
    • blhost -u 0x1fc9,0x01a2 -- configure-memory 0xa 0x2000d000
    • blhost -u 0x1fc9,0x01a2 -- get-property 25 0xa
    • blhost -u 0x1fc9,0x01a2 -t 100000 -- flash-erase-region 0x10000000 0x100000
    • blhost -u 0x1fc9,0x01a2 -t 100000 -- write-memory 0x10000000 xxx.bin

Note: xxx.bin is the target file which needs to be downloaded to the flash.

 

Author: Hao Liu 

Thanks for Hao Liu.

Tags (1)
Comments

Dear Alice-san,

$ dfu-util.exe –D flashloader.bin

I think I need a driver before doing the above, where can I get the driver?

Best Regards,

Yasushi Hasegawa

%3CLINGO-SUB%20id%3D%22lingo-sub-1105629%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUse%20blhost%20to%20program%2Ferase%20LPC54(S)0xx%20flash%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1105629%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CBLOCKQUOTE%20class%3D%22jive_macro_quote%20jive-quote%20jive_text_macro%22%3E%0A%3CP%3ENote%3A%20This%20document%20provides%20a%20simple%20description%2C%20the%20details%20about%20flashloader%20can%20be%20found%20at%26nbsp%3B%3CEM%3E%3CSTRONG%3EGetting%20Started%20with%20LPC540xx%20Flashloader%20User's%20Guide.pdf%26nbsp%3B%3C%2FSTRONG%3E%3C%2FEM%3Ewhich%20is%20located%20in%26nbsp%3B%3CEM%3ESDK_2.5.0_LPCXpresso54S018%5Cmiddleware%5Cmcu-boot%5Cdoc%3C%2FEM%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CBR%20%2F%3E%0A%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%0A%3CLI%3E%3CSPAN%3E%3CSTRONG%3EDownload%20LPC54S0xx%20SDK.%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CBR%20%2F%3E%0A%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%0A%3CLI%3E%3CSPAN%3E%3CSTRONG%3ECompile%20the%20flashloader%20project%20to%20generate%20flashloader.bin%3C%2FSTRONG%3E%3C%2FSPAN%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%3E%26nbsp%3BThe%20project%20is%20located%20in%20%3CEM%3E%3CSTRONG%3Esdk%5Cboards%20%5Clpcxpresso54s018%5Cbootloader_examples%5Cflashloader%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CBR%20%2F%3E%0A%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%0A%3CLI%3E%3CSPAN%3E%3CSTRONG%3EUse%20dfu-util.exe%20or%20IDE%20to%20load%20flashloader.bin%20into%20RAM.%3C%2FSTRONG%3E%3C%2FSPAN%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%3Edfu-util%20can%20be%20downloaded%20from%20%3CA%20href%3D%22http%3A%2F%2Fdfu-util.sourceforge.net%2Freleases%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fdfu-util.sourceforge.net%2Freleases%2F%3C%2FA%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3EConfigure%20the%20ISP%20pins%20and%20then%20reset%20the%20chip%20to%20make%20the%20chip%20to%20enter%20USB1%20DFU%20boot%20mode.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%0A%3CTABLE%20style%3D%22border%3A%20none%3B%22%20width%3D%22576%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22122.879px%22%20style%3D%22border%3A%20solid%20black%201.0pt%3B%20background%3A%20%23D9D9D9%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3E%3CSTRONG%3EBoot%20mode%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2284.9621px%22%20style%3D%22border%3A%20solid%20black%201.0pt%3B%20border-left%3A%20none%3B%20background%3A%20%23D9D9D9%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3E%3CSTRONG%3EISP2%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPIO0_6%20pin%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2284.9621px%22%20style%3D%22border%3A%20solid%20black%201.0pt%3B%20border-left%3A%20none%3B%20background%3A%20%23D9D9D9%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3E%3CSTRONG%3EISP1%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPIO0_5%20pin%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2284.9621px%22%20style%3D%22border%3A%20solid%20black%201.0pt%3B%20border-left%3A%20none%3B%20background%3A%20%23D9D9D9%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3E%3CSTRONG%3EISP0%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPIO0_4%20pin%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22196.894px%22%20style%3D%22border%3A%20solid%20black%201.0pt%3B%20border-left%3A%20none%3B%20background%3A%20%23D9D9D9%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3E%3CSTRONG%3EDescription%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22122.879px%22%20style%3D%22border%3A%20solid%20black%201.0pt%3B%20border-top%3A%20none%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3E%3CSTRONG%3EUSB1%20DFU%20boot%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2284.9621px%22%20style%3D%22border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20black%201.0pt%3B%20border-right%3A%20solid%20black%201.0pt%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3ELOW%3C%2FTD%3E%0A%3CTD%20width%3D%2284.9621px%22%20style%3D%22border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20black%201.0pt%3B%20border-right%3A%20solid%20black%201.0pt%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3ELOW%3C%2FTD%3E%0A%3CTD%20width%3D%2284.9621px%22%20style%3D%22border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20black%201.0pt%3B%20border-right%3A%20solid%20black%201.0pt%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3EHIGH%3C%2FTD%3E%0A%3CTD%20width%3D%22196.894px%22%20style%3D%22border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20black%201.0pt%3B%20border-right%3A%20solid%20black%201.0pt%3B%20padding%3A%200cm%205.4pt%200cm%205.4pt%3B%22%3E%0A%3CP%3EUSB%20DFU%20class%20is%20used%20to%20download%20image%20over%20the%20USB1%20high-speed%20port%20into%20SRAM.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EConnect%20the%20LPC54S0xx%20device%20USB1%20high-speed%20port%20and%20PC%20with%20USB.%20The%20following%20is%20the%20command%20line%20to%20load%20the%20flashloader.bin%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22padding-left%3A%2060px%3B%22%3E%3CSPAN%3E%3CSTRONG%3E%24%20dfu-util.exe%20%E2%80%93D%20flashloader.bin%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2060px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%0A%3CLI%3E%3CSPAN%3E%3CSTRONG%3EUse%20blhost%20to%20program%2Ferase%20LPC540xxM%2FLPC54S0xxM%20flash%3C%2FSTRONG%3E%3C%2FSPAN%3E%0A%3CUL%3E%0A%3CLI%3E%0A%3CP%3EOnce%20the%20flashloader%20binary%20is%20downloaded%20and%20starts%20its%20execution%20on%20the%20LPC54S0xx%20platform%20and%20there%20remains%20a%20physical%20USB%20connection%20between%20the%20LPC54S0xx%20platform%20%3CSTRONG%3EUSB1(High-Speed)%3C%2FSTRONG%3E%20and%20host%2C%20the%20flashloader%20will%20be%20ready%20to%20receive%20the%20commands.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3Eblhost%20-u%200x1fc9%2C0x01a2%20--%20get-property%2012%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3Eblhost%20-u%200x1fc9%2C0x01a2%20--%20fill-memory%20%3CEM%3E0x2000d000%3C%2FEM%3E%204%200xc0000004%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3Eblhost%20-u%200x1fc9%2C0x01a2%20--%20configure-memory%200xa%20%3CEM%3E0x2000d000%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3Eblhost%20-u%200x1fc9%2C0x01a2%20--%20get-property%2025%200xa%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3Eblhost%20-u%200x1fc9%2C0x01a2%20-t%20100000%20--%20flash-erase-region%200x10000000%200x100000%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3Eblhost%20-u%200x1fc9%2C0x01a2%20-t%20100000%20--%20write-memory%200x10000000%20xxx.bin%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CBLOCKQUOTE%20class%3D%22jive_macro_quote%20jive-quote%20jive_text_macro%22%3E%0A%3CP%3ENote%3A%26nbsp%3B%3CSTRONG%3Exxx.bin%20%3C%2FSTRONG%3Eis%20the%20target%20file%20which%20needs%20to%20be%20downloaded%20to%20the%20flash.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EAuthor%3A%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fpeople%2Fnxf47345%22%20target%3D%22_blank%22%20data-content-finding%3D%22Community%22%20data-userid%3D%22321104%22%20data-username%3D%22nxf47345%22%3EHao%20Liu%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20%3CA%20class%3D%22%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fpeople%2Fnxf47345%22%20target%3D%22_blank%22%20data-content-finding%3D%22Community%22%20data-userid%3D%22321104%22%20data-username%3D%22nxf47345%22%3EHao%20Liu%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎07-15-2022 12:16 AM
Updated by: