2014-08-08 04:36 AM
I'm trying to program an stm8s105 using icp method through the swim interface and using an STM32F4 discovery board as host and a firmware written by me.
I can enable the swim interface of the stm8s and i can read and write eeprom memory and registers, i can also read flash program memory but i can not enable write access to this memory in fact the PUL bit in the FLASH_IAPSR register is always set to 0 even after a successfull writing of FLASH_PUKR register. Has anyone encountered similar issues? Any advice or useful information is very welcome2014-08-08 08:45 AM
Hi
It is all horrible - truly horrible! Do you do the 'unlock' with the 'entry' ? // unlock FLASH memory (MASS sequence) // Write 0x56 then 0xAE in FLASH_PUKR (0x5062) Do you write 0x10 to FLASH_CR2 0xFE to FLASH_NCR2 to start the sector programming sequence?2014-08-08 09:55 AM
Hi,
i am not trying to do block programming, i am trying to do byte programming with the WOTF command as explained in the document PM0051 and i follow all the steps explained at the paragraph 4.6.1 ICP Methods - First method but i am able only to unlock the eeprom memory2014-08-11 03:29 AM
OK OK - I did say the whole thing is horrible.
All I can do is tell you what I do for the SWIM entry sequence: Set STM8 reset SWIM entry ( 4 long pulses, 4 short pulses) delay 6ms Send SWIM Comms reset (128 x HSI) delay 3 ms write 0xA0 into SWIM_CSR delay 3 ms clear STM8 reset delay 7ms stall the STM8 - set stall bit in DM_CSR2 delay 7ms write 0xA4 to SWIM_CSR delay 7ms unlock FLASH memory (MASS sequence) Write 0x56 in FLASH_PUKR (0x5062) then 0xAE in FLASH_PUKR (0x5062) This works for me (but is not what the ST-Link does) Also, because the programming sequence for the other devices in my system, my code will do a block erase before the programming.2014-08-21 03:18 AM
Sorry for the delay in answering but I had problems with the ADSL service, I tried to program another STM8 of the same type and this time I could write also the flash program memory, both with the code that I used and also with the changes that you suggested to me, so I concluded that the first STM8 was defective.
However, in two weeks I should receive an st-link and using that i will verify if the first stm8 is faulty or not. Regards