Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot program STM8S105K6 anymore #11

Closed
roybaer opened this issue Jan 13, 2019 · 5 comments
Closed

Cannot program STM8S105K6 anymore #11

roybaer opened this issue Jan 13, 2019 · 5 comments

Comments

@roybaer
Copy link

roybaer commented Jan 13, 2019

I cannot program my STM8S105K6-based boards anymore, which used to work.

Versions prior to 1d91c12:

> ./stm8gal -p /dev/ttyUSB0 -u 2 -R 1 -w /tmp/arduino_build_28225/Blink.ino.hex  

stm8gal (v1.2.0 beta)
  load Intel hex file 'Blink.ino.hex' ... ok (2.7kB)
  reset STM8 and press <return>
  open serial port '/dev/ttyUSB0' with 230.4kBaud ... ok
  synchronize ... ok (ACK)
  determine device ... ok (STM8S; 32kB flash; BSL v1.3)
  Uploading RAM routines ... ok (304B from 0x00a0)
  write 2.7kB (0x8000 to 0x8aa5) ... ok   
  read 2.7kB (0x8000 to 0x8aa4) ... ok
  verify memory ... ok
  activate bootloader ... ok
  jump to address 0x8000 ... ok
done with program

1d91c12 and later:

> ./stm8gal -p /dev/ttyUSB0 -u 2 -R 1 -w /tmp/arduino_build_28225/Blink.ino.hex 

stm8gal (v1.2.0 beta)
  load Intel hex file 'Blink.ino.hex' ... ok (2.7kB)
  reset STM8 and press <return>
  open serial port '/dev/ttyUSB0' with 230.4kBaud ... ok
  synchronize ... 

error in 'bsl_sync()': no response from BSL, exit!

They are connected via a CH340G USB-to-serial interface on the same board and I'm using Linux.

@gicking
Copy link
Owner

gicking commented Jan 19, 2019

hi roybaer,

sorry for the late reply, but I had to dig deep to find my USB<->UART adapter again. Anyway, now I have a setup with PC <-> STMS-Discovery. The latter has a STM8S105C6, which is the closest I have to your STM8S105K6 board. Unfortunately I cannot reproduce the bug as both versions work :-(

branch master:

./stm8gal -p /dev/ttyUSB1 -b 19200 -w main.ihx -V 3 -u 2

stm8gal (v1.1.8)
  load Intel hex file 'main.ihx' ... ok (441B)
  reset STM8 and press <return>
  open serial port '/dev/ttyUSB1' with 19.2kBaud ... ok
  synchronize ... ok (ACK)
  determine device ... ok (STM8S; 128kB flash; BSL v2.1)
  Uploading RAM routines ... ok (352B from 0x00a0)
  write 441B (0x8000 to 0x81b9) ... ok   
  read 441B (0x8000 to 0x81b8) ... ok
  verify memory ... ok
  activate bootloader ... ok
  jump to address 0x8000 ... ok
done with program

branch develop:

./stm8gal -p /dev/ttyUSB1 -b 19200 -w main.ihx -v 3

stm8gal (v1.3.0 beta)
  reset STM8 and press <return>
  open serial port '/dev/ttyUSB1' with 19.2kBaud ... done
  synchronize ... done (ACK)
  check UART mode ... done (2-wire reply)
  get device info ... done (STM8S; 128kB flash; BSL v2.1)
  upload RAM routines ... done (352B in 0x00a0 - 0x01ff)
  load 'main.ihx' ... done (1074B)
  convert Intel HEX file ... done (441B in 0x8000 - 0x81a0)
  write 441B / 441B in 0x8000 to 0x81b8 ... done   
  read 441B / 441B from 0x8000 to 0x81b8 ... done   
  verify memory ... done
  jump to address 0x8000 ... done
done with program

I will today check all other boards / STM8-variants I have and let you know. Independently, could you provide a source for your sduino_uno board which seems to show the issue with the new version? Actually I was planning to order one anyway, so no harm done there. Nice work! :-)

PS: can you please re-check using the parameters as above: low baudrate, auto-detect mode, high verbosity

@gicking
Copy link
Owner

gicking commented Jan 19, 2019

Update:

I checked the below boards with branch develop, auto-detect UART-mode (default), and 230kBaud. Launch as: ./stm8gal -p /dev/ttyUSB1 -b 230400 -w main.ihx

Can you please check again

  • if you have the latest Github develop branch and recompile
  • check with ./stm8gal -p /dev/ttyUSB1 -b 230400 -w main.ihx
  • and just to make sure also with ./stm8gal -p /dev/ttyUSB1 -b 19200 -w main.ihx

As said, I don't get any further here right now, sorry!

gicking added a commit that referenced this issue Feb 1, 2019
fixed issue #11 (see #11)
- get_port_attributes() RTS and DTR status was always read back as
   'true' ->
- set_port_attributes() then set RTS and DTR always to 'active'
@gicking
Copy link
Owner

gicking commented Feb 1, 2019

hi roybaer,
fixed it (hopefully). Can you please check branch develop again and provide feedback? Thanks in advance!

The bug was a stupid & vs | copy & paste error in get_port_attributes(). This led to RTS and DTR being always active. My boards don't have DTR connected which is why I didn't see it before. But your sduino UNO is reset by DTR, which led to the observed loss of communication.

Thanks again for pointing this out, and also for the really nice board! Have a great day :-)

@roybaer
Copy link
Author

roybaer commented Feb 1, 2019

I can confirm that this solved the problem.

@gicking
Copy link
Owner

gicking commented Feb 2, 2019

:-)

I'll merge the changes back to main branch

@gicking gicking closed this as completed Feb 2, 2019
MarkStokes71 pushed a commit to MarkStokes71/stm8gal that referenced this issue Feb 17, 2021
fixed issue gicking#11 (see gicking#11)
- get_port_attributes() RTS and DTR status was always read back as
   'true' ->
- set_port_attributes() then set RTS and DTR always to 'active'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants