tgree / psdb

Python flasher and gdb server for various ARM debug probes.
GNU Lesser General Public License v2.1
13 stars 2 forks source link

error erasing/writing, Mac M1, stlink-v3 mini #101

Open erwincoumans opened 1 year ago

erwincoumans commented 1 year ago

I'm getting this error:

''' erwincoumans@Erwins-MBP build % psdb_flash_tool --connect-under-reset --erase Probing with SWD frequency at 1.000 MHz Set SWD frequency to 24.000 MHz Erasing entire flash... Traceback (most recent call last): File "/opt/homebrew/bin/psdb_flash_tool", line 8, in sys.exit(_main()) File "/opt/homebrew/lib/python3.10/site-packages/psdb/flash_tool.py", line 173, in _main main(rv) File "/opt/homebrew/lib/python3.10/site-packages/psdb/flash_tool.py", line 86, in main target.flash.erase_all() File "/opt/homebrew/lib/python3.10/site-packages/psdb/devices/stm32h7/flash.py", line 219, in erase_all with self._flash_bank_unlocked(self.banks[1]): IndexError: list index out of range '''

Since nbanks=1, I removed access to bank[1] and now it succeeds, but another error:

''' Unexpected error 0x11 at 0x08000020 '''

Any idea?

tgree commented 1 year ago

Hi @erwincoumans - I apologize I totally missed this issue you raised back in October! Which microprocessor version were you using this on? I see H7 in the traceback, but there are quite a few different variants. I'm just looking at my H745 reference manual and it says there are always 2 banks, but I know there are other variants (H750 I think, for instance) that only have a single 128K sector so only a single bank - maybe you are using one of those?

If you use the --verbose option when running the command it will actually print out a bunch of information about what types of processor and peripheral IDs it sees, which can be helpful in identifying the hardware.

Sorry again for the very late reply!

erwincoumans commented 1 year ago

Thanks for getting back to me, this is just some spare time project, haven't gotten back to it for a while.

Let me check and get back. This is the STM32H750 on the Electro-smith Daisy Seed, a programmable Eurorack module. https://www.electro-smith.com/daisy/daisy

tgree commented 1 year ago

I thought I had a H750 lying around somewhere, but can't seem to find it. That Daisy Seed board looks pretty cool, so I've ordered one.

I forgot to ask: which debug probe are you using? Based on the error message I think it is an STLINK standalone probe of some sort. I have a V3SET so if that is what you were testing with then we will at least be using the same probe. Error 0x11 is "SWD_AP_FAULT" which could indicate that the probe is having trouble talking to the target and might work better at a slower clock speed. After psdb probes the target, if it was able to successfully identify it then it selects the maximum clock speed that it thinks that target can handle (in your case, 24 MHz). However, it turns out that that speed can sometimes be a bit optimistic.

In the current psdb release there isn't a way to restrict the max speed used during flashing; however in the current HEAD of the repository I have added a new '--max-tck-freq' option to flash_tool.py and gdb_tool.py if you feel like trying out lower clock speeds while I wait for my Daisy Seed to show up.