You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please let me know if I am doing anything wrong, and if so, what I need to change to make this work. I read the main.c file, and it looks like specifying the address as either 'opt' or '0x487E' should work.
Thanks,
Sam
The text was updated successfully, but these errors were encountered:
That didn't seem to work, when I read off the values at 0x487E it is still 0xFF00.
I was reading the programming manual page 22, and it seems to say that the FLASH_CR2 register must be set first:
Option bytes can be modified both in user/IAP mode and ICP mode (using the SWIM), except for the readout protection which can only be removed in ICP mode. In ICP mode, the OPT and NOPT bits of the FLASH_CR2 and FLASH_NCR2 registers must be set to their active state before attempting to modify the option bytes (OPT = 1 and NOPT = 0).
On page 23 it says that the FLASH_DUKR register must be set as well
The option bytes are write protected (locked) until the correct MASS key is written in the FLASH_DUKR (with OPT set to ‘1’). It is possible to lock the memory again by resetting the DUL bit in the IAPSR register. If wrong keys are provided, another key program sequence can be performed without resetting the device.
Are these registers set by specifying -s opt in the command, or do I need to add this to the hex file as well?
I could just be doing this wrong, but I am unable to write to the option byte area on my device.
When I run
./stm8flash -c stlink -p stm8s105c4 -s opt -r ../etc/test
I correctly get the default option bytes as specified in the data sheet.
However, when I try to write to them, then read again, nothing has changed. Here is my process:
I wrote a hex file as follows:
:02487E0055AA39
:00000001FF
The goal here is to write the boot loader enable bytes which are supposed be at 0x487E according to the data sheet.
Here is the command I ran to try and write this file:
./stm8flash -c stlink -p stm8s105c4 -s opt -w ../ob.hex
I have also tried the following, which also didn't work:
./stm8flash -c stlink -p stm8s105c4 -s 0x487E -w ../ob.hex
Please let me know if I am doing anything wrong, and if so, what I need to change to make this work. I read the main.c file, and it looks like specifying the address as either 'opt' or '0x487E' should work.
Thanks,
Sam
The text was updated successfully, but these errors were encountered: