https://open-source-silicon.dev logo
Title
y

Yatharth Agarwal

02/06/2023, 6:23 PM
I managed to use the HK-Flash bridge to flash the gpio_test.hex to the caravel ( without the Hat connected to the Nucleo ). Now I am stuck in weird situation because as soon as the board is powered on, the Caravel reads from flash and starts executing the code. Because of this I am no longer able to flash any other code or use the caravel_hkdebug interface. IS there a specific power on sequence that has to be followed in order to access the hk_spi again? If so does it involve controlling the reset pin? as without the nucleo, the only way to reset is via the push button.
t

Tim Edwards

02/06/2023, 8:23 PM
Yes. It's not particularly convenient, but if you want to flash a new program, e.g., using
caravel_hkflash.py
, then do the following: (1) Hold down the reset button (2) Power cycle the device by unplugging/replugging the USB (do not let go of the reset button!) (3) Run
caravel_hkflash.py
. Once the program is communicating with Caravel, it will use an internal reset via the SPI to hold the processor in reset, so once you see text coming back from the chip, you can finally let go of the reset button.
Likewise, you can use
caravel_hkdebug.py
after doing the same power cycle + holding down the reset button. Once you get the debug menu, use it to put the processor into reset, then you can let go of the reset button.
It's actually a bit more convenient using the Nucleo because you can directly control both power and reset from the Nucleo board using micropython. You can also set up the serial communication; that's what's used with
make flash
in the
nucleo/
directory for use with the Nucleo board; it's just the
caravel_hkflash.py
code slightly rewritten to set it up on the Nucleo. I have been able to read and write registers using the housekeeping SPI by making calls directly from micropython using
mpremote
on the Nucleo.