Optiboot / optiboot

Small and Fast Bootloader for Arduino and other Atmel AVR chips
Other
1.08k stars 396 forks source link

soft uart issue #329

Closed sotivirus closed 2 years ago

sotivirus commented 2 years ago

Hi! Having an issue with soft uart. It looks like optiboot does not set tx high, until it sends the first byte. Afterwards it stays high. 001 1st try from avrdude (corrupted response): 002 2nd try works: 003 sketch uploads successfully.

So on the PC it works fine on the second try, but I want to use bluino to flash my project through bluetooth, and unlike avrdude on the PC, it fails.

Optiboot downloaded from github Nov 2020, compile environment: arduino 1.0.6

WestfW commented 2 years ago

Neat. I can confirm that the soft uart code does not seem to set the pin state to high during initialization. And as far as I can tell, it never has. I guess no one has noticed since it works on the second try.

WestfW commented 2 years ago

I've committed a fix. https://github.com/Optiboot/optiboot/commit/c377eb8dee635c375014a78f6558668d14c1127b#diff-1f550075d70f3bf9d9cde6e032755af724200cde9e40f33b7e29fd052062576d Could you test? There's some chance that the post-reset "floating" state of the pin could still cause problems, but I THINK that the time in HIGH state that passes while blinking the LED should be long enough for any receiver to sync up...

sotivirus commented 2 years ago

Great, this fixes the first byte issue. Allthough I still couldn't upload, but that turned out to be an issue with the app (Bluino). It sends out multiple requests back to back (without waiting for a reply on each request, like avrdude does), and optiboot has to reply while data is still coming in. I guess it gets away with it on hardware uart. I ended up using another app (IoTool arduino). Thank's for the fix WestfW!