vdudouyt / stm8flash

program your stm8 devices with SWIM/stlinkv(1,2)
GNU General Public License v2.0
403 stars 183 forks source link

Can't write flash over stlink v2 #3

Closed plumbum closed 10 years ago

plumbum commented 10 years ago

I try flash over stlink v2, but get 'Tries exceeded'.

$ ./stm8flash -cstlinkv2 -pstm8l150 -w ../blink/blinky.bin TRACE: stlinkv2_open TRACE: programmer stlinkv2 Writing at 0x8000... TRACE: stlink2_swim_write_range TRACE: stlinkv2_init_session TRACE: stlinkv2_wirte_byte a0 00007f80 TRACE: stlinkv2_write_and_read_byte a0 00007f99 TRACE: stlinkv2_wirte_byte 00 000050c6 TRACE: stlinkv2_write_and_read_byte 00 00005054 TRACE: stlinkv2_wirte_byte 56 00005052 TRACE: stlinkv2_wirte_byte ae 00005052 TRACE: stlinkv2_wirte_byte ae 00005053 TRACE: stlinkv2_wirte_byte 56 00005053 TRACE: stlinkv2_write_and_read_byte 56 00005054 TRACE: stlinkv2_wirte_word 01fe 00005051 TRACE: stlink2_wait_until_transfer_completes TRACE: stlinkv2_write_and_read_byte 00 00005054 TRACE: stlinkv2_wirte_word 01fe 00005051 Tries exceeded

$ ./stm8flash -cstlinkv2 -pstm8s105 -w ../blink/blinky_s105.bin TRACE: stlinkv2_open TRACE: programmer stlinkv2 Writing at 0x8000... TRACE: stlink2_swim_write_range TRACE: stlinkv2_init_session TRACE: stlinkv2_wirte_byte a0 00007f80 TRACE: stlinkv2_write_and_read_byte a0 00007f99 TRACE: stlinkv2_wirte_byte 00 000050c6 TRACE: stlinkv2_write_and_read_byte 00 0000505f TRACE: stlinkv2_wirte_byte 56 00005062 TRACE: stlinkv2_wirte_byte ae 00005062 TRACE: stlinkv2_wirte_byte ae 00005064 TRACE: stlinkv2_wirte_byte 56 00005064 TRACE: stlinkv2_write_and_read_byte 56 0000505f TRACE: stlinkv2_wirte_word 01fe 0000505b TRACE: stlink2_wait_until_transfer_completes TRACE: stlinkv2_write_and_read_byte 00 0000505f TRACE: stlinkv2_wirte_word 01fe 0000505b Tries exceeded

vdudouyt commented 10 years ago

Dear Ivan,

Could you please take record with https://github.com/vdudouyt/usbsniff?

Thanks for your report

plumbum commented 10 years ago

$ sudo usb_capture 0483:3748 stlinkv2.log https://dl.dropboxusercontent.com/u/3073134/stlinkv2.log

Just tried to update the firmware on the ST-Link (V2.J17.x -> V2.J19.S4), but it did not help.

vdudouyt commented 10 years ago

Please try again with the branch named 'issue3'.

Thanks

vdudouyt commented 10 years ago

Thank you very much, just found a block size explanation in PM0051 document from ST. I've merged your pull request and will apply the same to stlinkv1 code as well.

Best Regards,

Valentin