I still don't know where the boot code is running from. What is it loaded into? You haven't answered my question so I guess I'll have to read the SBF part of the manual to find out.
It shifts data in from the SPI port and (optionally) into SRAM. So it is executing code from there.
But the interesting part of your report is:
> But /RSTOUT pin is asserted although failed.
And from your first post:
> Spftware reset failed sometimes, but /RSTOUT pin will also be asserted (from high to low level).
I'm having to assume that means that /RSTOUT asserts LOW, and then STAYS LOW. Is that what you're seeing?
Have a look at "12.4.2.1 Non-SBF Reset Sequence". That's not what you're doing (but it might be), but that shows where in the flow chart /RSTOUT is asserted and deasserted. As long as your hardware is correctly driving the BOOTMOD pins, it should be following "12.4.2.2 SBF Reset Sequence".
The problem I have with the manual is that the latter chart doesn't say where /RSTOUT is deasserted. I'm assuming at the end of that flow chart.
Anyway, either the hardware isn't getting into that flowchart, or it isn't getting out of it. So what could be going wrong that is preventing exit, or at least preventing everything from going perfectly and ending up with code being read from FLASH into SRAM and then being executed? Quite a lot.
So check the BOOTMOD pins to make sure they're hardwired or pulled to the right state.
Check that the oscillator is still running properly. You may have a board fault where there's a short between the DSPI pins and something that is affecting the clock or crystal.
So assuming it is in the SBF flowchart, either the data it is reading from the external chip is corrupted or the clock is stopping somehow, possibly by a bad value read from SBF_RCON.
So you should use an oscilloscope, and record all of the early SBF pin transitions for a "good boot", and then repeat it for a "bad boot" and see if there are any differences.
You may have a board fault where the DSPI0 pins are affecting the SBF pins. Except I've just found the SBF pins ARE the DSPI0 pins.
The SBF also depends on the device connected to the SBF pins being in the correct (reset or idle) state to recognise the READ command send to it. If the FLASH chip was left partially clocked or in the middle of something when the reset happened it could explain the problem.
> delay 200ms, Add this delay can reproduce the problem more easily
That sounds like you've got a floating pin that should be pulled up or down. Maybe you need pullups on SBF_CS, SBF_CK or SBF_DO. They could be floating into intermediate states and getting the FLASH chip out of sync.
Hey, the SBF and DSPI0 share pins! If you've been accessing DSPI0 then it will certainly have been affecting the pins connecting to that other device. You certainly need pullups on DSPI0_PCS1/SBF_CS and DSPI0_PCS0/SS so that the other chip is guaranteed to not be selected during the boot.
The problem may be that "DSPI0 is used to connect another device." and that device may still be driving the DSPI0_SIN/SBF_DI pin after its cycles, driving against the first FLASH device.
An oscilloscope is the first thing to try to find which of the above might be happening.
Tom