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

How to load firmware for SAM3X? #7

Open
houdonghui1 opened this issue Jun 26, 2023 · 5 comments
Open

How to load firmware for SAM3X? #7

houdonghui1 opened this issue Jun 26, 2023 · 5 comments

Comments

@houdonghui1
Copy link

Hello engineers!!
How can I load the firmware on the CW310 board onto the SAM3X on my board? Under what operating system can software be used to load firmware onto the MCU? Is there a method explanation?

@colinoflynn
Copy link
Contributor

Hello,

The SAM3X firmware uses the same firmware loading as ChipWhisperer, so it works in Python (Windows or Linux). The FW update mechanism is described at https://chipwhisperer.readthedocs.io/en/latest/scope-api.html#firmware-update .

If the SAM3X is blank, use:

import chipwhisperer as cw
programmer = cw.SAMFWLoader(scope=None)
programmer.program(<port>, 'CW310.bin')

Where is COMx, /dev/ttyUSB, etc depending on platform. You can also force erase the SAM3X with the 'erase' pins (jumper with wire/paperclip). But you can use the ChipWhisperer API to enter bootloader mode automatically too.

CW310 is built from running make here: https://github.com/newaetech/cw310-bergen-board/tree/main/microfw/CW310/src

@ViennaPan
Copy link

Hi Colinoflynn,
When I trying to do SAM3X with:
programmer = cw.SAMFWLoader(scope=target)
programmer.enter_bootloader(really_enter=True)

I see all the power are down in CW310 board, and cannot get the target for ever.
Do you know why this occurring?
Before this erasing, I can use the USB-C Data to get the target and do fpga_read and fpga_write already. Now all are not working as all power off.
Thanks,
Vienna

@colinoflynn
Copy link
Contributor

Hello,

This will just erase the SAM3X, does it come back up as a serial port? Are you on Windows or Linux? If on Linux you can check dmesg to see if the SAM3X comes up as a serial port. If you press the "USB RST" button, it will reenumeate the SAM3X which might make it more obvious (or unplug/replug USB cable):

image

The command from there is:

import chipwhisperer as cw
programmer = cw.SAMFWLoader(scope=None)
programmer.program(<port>, 'CW310.bin')

Where CW310.bin is available here. Just download to your local file.

If the serial port isn't coming up, it could be the erase failed. There is an "erase" jumper (pins) on the PCB, you can short with a paperclip/wire which should also force the erase.

image

@ViennaPan
Copy link

ViennaPan commented Jan 5, 2024

Hi colinoflynn,
Your method works. As the target cannot be get, I have to use the scope=None instead of scope=target in cw.SAMFWLoader. And the program is working. Thank you very much for the quick guidance.
Regards,
Vienna

@ViennaPan
Copy link

Hi colinoflynn,
The bin file "CW310 is built from running make here: https://github.com/newaetech/cw310-bergen-board/tree/main/microfw/CW310/src" has a problem that the byte counter of the bit 0 and bit 1 are by default as 1, which is not working for plaintext and key write (any other 16 bytes write will be failed:
image
I added a workaround to not use the lowest 2 bits and find out that it is not supporting bit index 5 and index 6.
Could you help to check why?
Thanks,
Vienna

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