Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
flashing-the-bootloader [2017/01/25 16:06]
arthur
flashing-the-bootloader [2021/02/22 17:49] (current)
Line 4: Line 4:
 </callout> </callout>
  
-The SD bootloader is used to facilitate firmware updates : You only need to flash it once, and it makes the first firmware flashing and subsequent firmware updates much more simple.+The SD bootloader is used to facilitate firmware updates : You only need to flash it once, and it makes the first firmware flashing and subsequent firmware updates much more simple.
  
 Basically at boot/reset, it looks for the firmware.bin file on the SD card, and if found, flashes it to the board's FLASH memory ( then renames the file to firmware.cur, so check for that to see if it worked ). Basically at boot/reset, it looks for the firmware.bin file on the SD card, and if found, flashes it to the board's FLASH memory ( then renames the file to firmware.cur, so check for that to see if it worked ).
Line 10: Line 10:
 So once the bootloader is installed, updating the firmware is as simple as copying it to the SD card and reset. So once the bootloader is installed, updating the firmware is as simple as copying it to the SD card and reset.
  
-The bootloader was written by Triffid_Hunter and can be found [https://github.com/triffid/LPC17xx-DFU-Bootloader here] on github.+The bootloader was written by Triffid_Hunter and can be found [[https://github.com/triffid/LPC17xx-DFU-Bootloader|here]] on github.
  
 == LPCXpresso1769 or SmoothieBoard == LPCXpresso1769 or SmoothieBoard
  
-To flash the bootloader you need a Serial-USB ( can be a FTDI cable, an arduino, CP2102, etc ) cable connected to the UART0 pins of the LPC1769 ( 6-pin connector noted as "Serial" on a [[smoothieboard]] ), and the "reset" and "bootloader" (ISP) buttons connected.+To flash the bootloader you need a Serial-USB ( can be a FTDI cable, an arduino, CP2102, etc ) cable connected to the UART0 pins of the LPC1769 ( 6-pin connector noted as "Serial" on a [[smoothieboard]] ), and the "reset" and "bootloader" (ISP) buttons connected.
  
-If you have a Smoothieboard, all of this is already there, just connect the Serial-USB/FTDI cable. ( well actually if you have a SmoothieBoard it comes the with the bootloader pre-flashed, just move ahead to the actual firmware flashing. Except for the beta board where you might want to flash anyway to get SDHC support ).+If you have a Smoothieboard, all of this is already there, just connect the Serial-USB/FTDI cable. ( well actually if you have a SmoothieBoard it comes with the bootloader pre-flashed, just move ahead to the actual firmware flashing. Except for the beta board where you might want to flash anyway to get SDHC support ).
 If you have a LPCXpresso1769, you want to look at [[Smoothie On A Breadboard ]] for how to wire the serial cable and the buttons. If you have a LPCXpresso1769, you want to look at [[Smoothie On A Breadboard ]] for how to wire the serial cable and the buttons.
  
 +(Sometimes it is better connecting TXD->RXD and RXD->TXD, you should not use USB to RS232, because it can be +15/-15v, but MCU is 3.3V)
 === Entering bootloader mode === Entering bootloader mode
  
 In order to flash the SD bootloader to the chip, you must first enter the Serial Bootloader mode. This mode allows you to write new code to the FLASH memory via UART0. In order to flash the SD bootloader to the chip, you must first enter the Serial Bootloader mode. This mode allows you to write new code to the FLASH memory via UART0.
-To enter this mode do the following : +To enter this mode do the following : 
  
  
-* Press the RESET button+* Press the RESET button
 * Press the BOOTLOADER (ISP) button * Press the BOOTLOADER (ISP) button
 * Release the RESET button * Release the RESET button
 * Release the BOOTLOADER (ISP) button * Release the BOOTLOADER (ISP) button
  
-=== Flashing the SD bootloader+=== Flashing the SD bootloader
  
-First install the [http://sourceforge.net/projects/lpc21isp/ lpc21isp] program if you are using linux, or the [http://www.flashmagictool.com/ FlashMagic] tool if you are using Windows.  For 64-bit OS X, lpc21isp is checked into Smoothie's git repository under the [https://github.com/arthurwolf/Smoothie/tree/edge/build/osx64/lpc21isp build/osx64/lpc21isp] directory.+First install the [[http://sourceforge.net/projects/lpc21isp/|lpc21isp]] program if you are using linux, or the [[http://www.flashmagictool.com/|FlashMagic]] tool if you are using Windows.  For 64-bit OS X, lpc21isp is checked into Smoothie's git repository under the [[https://github.com/arthurwolf/Smoothie/tree/edge/build/osx64/lpc21isp|build/osx64/lpc21isp]] directory.
  
 For FlashMagic you have to set the proper LPC device (or better select menu ISP>Read Device Signature.. )  and select COM port of your cable. Use 38400 Baud, Interface None (ISP) and Oscillator 12 MHz, check "erase blocks used by hex file". After selecting your HEX file and pressing the "Start" button FlashMagic will program it. For FlashMagic you have to set the proper LPC device (or better select menu ISP>Read Device Signature.. )  and select COM port of your cable. Use 38400 Baud, Interface None (ISP) and Oscillator 12 MHz, check "erase blocks used by hex file". After selecting your HEX file and pressing the "Start" button FlashMagic will program it.
  
-You can either compile the bootloader [https://github.com/triffid/LPC17xx-DFU-Bootloader from source], or simply download the .hex file [https://github.com/Smoothieware/Smoothieware/tree/edge/bootloader here]. Simply clicking the link may display it as a text file. You may need to do a "save as" to download the file.+You can either compile the bootloader [[https://github.com/triffid/LPC17xx-DFU-Bootloader|from source]], or simply download the .hex file [[https://github.com/Smoothieware/Smoothieware/tree/edge/bootloader|here]]. Simply clicking the link may display it as a text file. You may need to do a "save as" to download the file.
  
 Flashing pretty simple for windows, simply feed it the .hex file.  Flashing pretty simple for windows, simply feed it the .hex file. 
  
-For linux you want to do the following : +For linux you want to do the following : 
  
-[[code]]+<code>
 lpc21isp -wipe DFU-Bootloader.hex /dev/ttyACM0 230400 12000 lpc21isp -wipe DFU-Bootloader.hex /dev/ttyACM0 230400 12000
-[[/code]]+</code>
  
-Change {{/dev/ttyACM0}} to whatever matches your Serial-USB cable.+Change <kbd>/dev/ttyACM0</kbd> to whatever matches your Serial-USB cable.
  
 Now flashing occurs, and that's it! Now flashing occurs, and that's it!
Line 52: Line 53:
 == Mbed == Mbed
  
-Because the mBed has its own USB flashing thing, you don't want to use the SD bootloader with it.+Because the mBed has its own USB flashing thing, you don't want to use the SD bootloader with it.
  
-Instead simply replace the file **mbed/src/vendor/NXP/cmsis/LPC1768/GCC_ARM/LPC1768.ld** , with [https://gist.github.com/nullsub/10f4551eb0f3e2422409 this]+Instead simply replace the file **mbed/src/vendor/NXP/cmsis/LPC1768/GCC_ARM/LPC1768.ld** , with [[https://gist.github.com/nullsub/10f4551eb0f3e2422409|this]]
  
 Localstorage does not work out of the box with the mbed. But you can place your **config** into **src/config.default**. Your configuration will then be included in the firmware.bin Localstorage does not work out of the box with the mbed. But you can place your **config** into **src/config.default**. Your configuration will then be included in the firmware.bin
Line 60: Line 61:
 If want to use pins P0_9, P0_8, P0_7, P0_6, you need to comment SDcard support in **src/main.cpp**  If want to use pins P0_9, P0_8, P0_7, P0_6, you need to comment SDcard support in **src/main.cpp** 
  
-[[code]]+<code>
 //SDCard sd(P0_9, P0_8, P0_7, P0_6);      // this selects SPI1 as the sdcard as it is on Smoothieboard //SDCard sd(P0_9, P0_8, P0_7, P0_6);      // this selects SPI1 as the sdcard as it is on Smoothieboard
-[[/code]]+</code>
  
 To create the Smoothie firmware run the following command from the root Smoothie directory. To create the Smoothie firmware run the following command from the root Smoothie directory.
  
-[[code]]+<code>
 ./BuildShell && make clean all ./BuildShell && make clean all
-[[/code]]        +</code>
  
 Once you have compiled Smoothie simply copy the generated **LPC1768/main.bin** file to the mBed's drive. Once you have compiled Smoothie simply copy the generated **LPC1768/main.bin** file to the mBed's drive.
  
-A working fork is available [https://github.com/nullsub/Smoothieware here]+A working fork is available [[https://github.com/nullsub/Smoothieware|here]]
  
 //Old: //Old:
-You can find a more detailed guide at running smoothie on the mbed [http://mbed.org/users/scotto/notebook/smoothie-firmware-for-mbed/ here].+You can find a more detailed guide at running smoothie on the mbed [[http://mbed.org/users/scotto/notebook/smoothie-firmware-for-mbed/|here]].
  
 == Direct Serial Bootloader flashing == Direct Serial Bootloader flashing
  
-Instead of using mBed's own USB flashing util, we can use the [http://sourceforge.net/projects/lpc21isp/ lpc21isp] program to flash Smoothieware directly.+Instead of using mBed's own USB flashing util, we can use the [[http://sourceforge.net/projects/lpc21isp/|lpc21isp]] program to flash Smoothieware directly.
 This means we will not be getting SD card support, as we'll be flashing over the SD bootloader. This means we will not be getting SD card support, as we'll be flashing over the SD bootloader.
  
 The approach is similar to what's explained in the Mbed section. The approach is similar to what's explained in the Mbed section.
  
-A working fork for this based upon the Mbed usb flashing, can be found [https://github.com/Skeen/Smoothieware here]+A working fork for this based upon the Mbed usb flashing, can be found [[https://github.com/Skeen/Smoothieware|here]]