I have a strange problem with custom RZ/A1H board and I am getting our of ideas.
The code in question is modified RZ_A1H_QSPI_LOADER example. I have added serial communication for firmware update.
The code runs fine in most cases except after power-on reset.
Cases when the SW runs fine:
- loading from J-link and immediate start (debug session from E2 studio)
- software is pre-loaded (flashed) - restart from debug menu of E2 studio
- software is pre-loaded, power cycle is performed, connect from Jlink.exe, then "reset", then "go", then another "go" (last go could be any other command - regs for example) - SW DOES NOT start after the first go (???)
Cases when the SW does not start:
- software is pre-loaded, power cycle is done
- attempt to connect with debugger without reset (e.g. Segger's OZONE) fails with error Could not start the CPU or similar (needs explicit reset and after that is connects)
- software is pre-loaded, system is power cycled, SW does not start but then I make pin reset (short RST pin to ground go a moment) - when I release the RST the SW starts
Up to now I have checked with Jlink:
- power cycle the board
- "connect" with Jlink.exe
- check the PC(R15) - either FFFF0000 or FFFF0008 (UNDEF) - resetting with "r" and then "g" and then another "g" starts the SW correctly
This undefined exception is suspicios - it could explain all this strange signs, but I am not able to figure out how this could happen on power on reset only? Why after debug reset and twice "go" it starts?
Areas to investigate now are:
- RST pin control (reset supervisor, timing, levels - oscilloscope shot)
- SPI FLASH access (in relation to the RST rising edge) - maybe we get corrupted data on power on reset (the FLASH chip startup issue, could it be that the RZ requests data too early? I suppose not - the ROM loader probably checks for CFI information before fetching the 0x18000000 - but this is not known)
I think I am out of ideas what to investigate and how. Simple tests does not help, trying to "attach to running program" (from OZONE) and see where the CPU hangs also does not work.
The issue is quite specific so I don't expect ready solution, but maybe some help on how to search for the problem?