Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Grand Central M4 bootloader .bin file #266

Closed
dcelectr opened this issue Sep 27, 2020 · 6 comments
Closed

Missing Grand Central M4 bootloader .bin file #266

dcelectr opened this issue Sep 27, 2020 · 6 comments

Comments

@dcelectr
Copy link

dcelectr commented Sep 27, 2020

I need the bootloader file "bootloader-grandcentralM4-v2.0.0-adafruit.5.bin" or "bootloader-grandcentralM4-v2.0.0-adafruit.5.elf" because I want to experiment with the Grand Central M4 board and Atmel Studio.

After I erase the ATSAMD51P20A chip, I want to be able to restore the Grand Central M4 board to its original condition with Atmel Studio.

A set of well written instructions (which I successfully implemented on Feather M0 and Metro M0 because I had the .bin files for these boards) is available here:
https://learn.adafruit.com/how-to-program-samd-bootloaders/programming-the-bootloader-with-atmel-studio

Additional search effort to find the bootloader file for the Grand Central M4 board brought me to a similar request that is posted on Adafruit forum.
https://forums.adafruit.com/viewtopic.php?f=63&t=168879

@dcelectr dcelectr changed the title Bootloader folder "grand_central_m4" missing from the ArduinoCore-samd Bootloader folder "grand_central_m4" is missing from the ArduinoCore-samd Sep 27, 2020
@hathach
Copy link
Member

hathach commented Sep 30, 2020

thanks, we will add the missing bootloader file soon, you could find the latest binary of bootlaoder here in its repo's release assests.

https://github.com/adafruit/uf2-samdx1/releases

@dcelectr
Copy link
Author

Thank for your response.

  • It addresses the need to have a .bin bootloader file to program a fully erased ATSAMD51P20A chip on Grand Central M4 board.

  • It provides the link to latest version of the bootloader and eliminates the extra step to drag & drop the "update-bootloader-grandcentral_m4-v3.10.0.uf2" file in the CGM4BOOT storage media after flashing the chip with the requested "bootloader-grandcentral_m4-v2.0.0-adafruit.9.bin" file.

Would you please consider including the source files as well?

Best Regards!

@dhalbert
Copy link

You need to set the BOOTPROT fuses to protect the bootloader if you load it manually. I am not sure if your process The update-bootloader .uf2 does this as part of the updating process, which is why we recommend using it. If you erase the bootloader completely you could load it manually and then run the update-bootloader uf2 for the same version to do this easily.

@hathach
Copy link
Member

hathach commented Oct 1, 2020

Would you please consider including the source files as well?

which source files you are mentioning, if you mean the bootlaode source, it is there in the above repo.

@dcelectr
Copy link
Author

dcelectr commented Oct 1, 2020

You need to set the BOOTPROT fuses to protect the bootloader if you load it manually. I am not sure if your process The update-bootloader .uf2 does this as part of the updating process, which is why we recommend using it. If you erase the bootloader completely you could load it manually and then run the update-bootloader uf2 for the same version to do this easily.

Yes Dan, I agree. I need to set the fuse BOOTPROT back to value 16 for the Grand Central M4 board after programing the chip with the .bin file.

It's worth making a note that the BOOTPROT for the Grand Central M4 board is different from the M0 boards that have fuse BOOTPROT set to SIZE_8192BYTES, or the 0x07 value as shown in the tutorial for Feather M0 and Metro M0.

My understanding is that the .uf2 file unlocks the BOOTPROT fuse (and probably doesn't care if it finds this fuse unlocked), updates the bootloader and locks the BOOTPROT fuse to the appropriate value. This is another method to set the fuse (instead of using Atmel Studio to do it manually). I just use the Atmel Sudio because the fuse programing is in the same Device Programming pop-up window.

Below is the original fuse settings for the Grand Central M4 as a reference.

USB_TRANSN = 0x09
USB_TRANSP = 0x19
USB_TRIM = 0x06
ROOM_TEMP_VAL_INT = 0x1E
ROOM_TEMP_VAL_DEC = 0x00
HOT_TEMP_VAL_INT = 0x69
HOT_TEMP_VAL_DEC = 0x00
ROOM_INT1V_VAL = 0x02
HOT_INT1V_VAL = 0x00
ROOM_ADC_VAL_PTAT = 0xA7F
HOT_ADC_VAL_PTAT = 0xD21
ROOM_ADC_VAL_CTAT = 0xB4B
HOT_ADC_VAL_CTAT = 0x944
BOD33_DIS = [X]
BOD33USERLEVEL = 0x1C
BOD33_ACTION = RESET
BOD33_HYST = 0x02
NVMCTRL_BOOTPROT = 16
NVMCTRL_SEESBLK = 0x00
NVMCTRL_SEEPSZ = 0x00
RAMECC_ECCDIS = [X]
WDT_ENABLE = [ ]
WDT_ALWAYSON = [ ]
WDT_PER = CYC16384
WDT_WINDOW = CYC16384
WDT_EWOFFSET = CYC16384
WDT_WEN = [ ]
NVMCTRL_REGION_LOCKS = 0xFFFFFFFF

SW0_WORD_0 = 0x1FF07FD (valid)
SW0_WORD_1 = 0x1B29 (valid)
TEMP_LOG_WORD_0 = 0x206901E (valid)
TEMP_LOG_WORD_1 = 0xD21A7F00 (valid)
TEMP_LOG_WORD_2 = 0xFF944B4B (valid)
USER_WORD_0 = 0xF69A9239 (valid)
USER_WORD_1 = 0xAEECFF80 (valid)
USER_WORD_2 = 0xFFFFFFFF (valid)

@dcelectr
Copy link
Author

dcelectr commented Oct 1, 2020

Would you please consider including the source files as well?

which source files you are mentioning, if you mean the bootlaode source, it is there in the above repo.

Here is an example of the Metro M4 board which includes the bootloader source files.
https://github.com/adafruit/ArduinoCore-samd/tree/master/bootloaders/metroM4
It's nice to have the source files and make the bootloader from scratch as a learning opportunity and start experimenting with it.
Your response addressed the need to locate a bootloader .bin file for the Grand Central M4 board.
I should revise the title of this issue to "Missing Grand Central M4 bootloader .bin file" and close it.
Thanks!

The back story.
What prompted me to requesting the "bootloader-grandcentralM4-v2.0.0-adafruit.5.bin" file was when I tried to program the Grand Central M4 bootloader with the Arduino IDE and gave me this error message, which pointed at the location of the needed bootloader.

Arduino: 1.8.13 (Windows 10), Board: "Adafruit Grand Central M4 (SAMD51), Enabled, 120 MHz (standard), Small (-Os) (standard), 50 MHz (standard), Arduino, Off"
C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/bin/openocd.exe -d2 -s C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/share/openocd/scripts/ -f C:\Users\user\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.2/variants/grand_central_m4/openocd_scripts/arduino_zero.cfg -c telnet_port disabled; init; halt; at91samd bootloader 0; program {C:\Users\user\AppData\Local\Arduino15\packages\adafruit\hardware\samd*1.6.2/bootloaders/grand_central_m4/bootloader-grandcentralM4-v2.0.0-adafruit.5.bin
} verify reset; shutdown
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
...blah blah
embedded:startup.tcl:60: Error: Can't find C:\Users\user\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.2/variants/grand_central_m4/openocd_scripts/arduino_zero.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 60
Error while burning bootloader.*

I have successfully programmed the bootloader for Metro M0 and Feather M0 with Arduino IDE (with previously unlocked and fully erased chips) and locked the fuse BOOTPROT afterwards with Atmel Studio 7.
Currently,this is not possible (with Arduino IDE) for some of the M4 boards (Feather M4 and Metro M4) I tried out because they are missing the "openocd_scripts/xxxxxxx_m0.cfg" files.

For example, the Metro M0 has the openocd_scripts folder with the "metro_m0.cfg" file.
ArduinoCore-samd/variants/metro_m0/openocd_scripts/ metro_m0.cfg
Howerver, the following boards do not have the "openocd_scripts" folder.
ArduinoCore-samd/variants/feather_m4/
ArduinoCore-samd/variants/grand_central_m4/
ArduinoCore-samd/variants/metro_m4/

However, this a separate issue, which would be resolved at some time as the parts of the project get committed.

@ladyada ladyada closed this as completed in 4c6d754 Oct 1, 2020
@dcelectr dcelectr changed the title Bootloader folder "grand_central_m4" is missing from the ArduinoCore-samd Missing Grand Central M4 bootloader .bin file Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants