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

Timeout issue on Raspbian Jessie, Raspberry Pi 2 as of version 0.34.4 #4

Closed
Gadgetoid opened this issue Jan 11, 2016 · 8 comments
Closed

Comments

@Gadgetoid
Copy link
Contributor

I've found a regression between version 0.33.3 and 0.34.4 where uploading over /dev/ttyAMA0 on the Raspberry Pi 2 no longer seems to work due to our old friend Mr Timeout.

I've installed both loaders side-by-side on my Pi 2 and here's the output from each:

From 0.34.4:

pi@raspberrypi ~/propide $ propman-0.34.4 ~/Untitled.binary
pm.loader: [ttyAMA0] Preparing image...
pm.loader: [ttyAMA0] Downloading to RAM...
pm.loader: [ttyAMA0] ERROR: Download timed out

From 0.33.3

pi@raspberrypi ~/propide $ propman ~/Untitled.binary
propeller.manager: opening "ttyAMA0"
propeller.manager: attaching PropellerSession(0x405f68) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x405f68) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x405f68) to "ttyAMA0"
[PropellerManager] ttyAMA0: Downloading image (56 bytes, 441 ms)
[PropellerManager] ttyAMA0:                     ... 199 ms elapsed
[PropellerManager] ttyAMA0: Verifying RAM
[PropellerManager] ttyAMA0:                     ... 341 ms elapsed
[PropellerManager] ttyAMA0: DOWNLOAD COMPLETE
propeller.manager: detaching PropellerSession(0x405f68) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x405f68) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x405f68) from "ttyAMA0"
propeller.manager: closing "ttyAMA0"

It dawned on me pretty quickly what the likely problem is, but I'm not sure I want to believe my own assumption. I'm going to hazard a guess that the removal of some debug output has caused PropellerManager to speed up to the point where it's no longer compatible with the Pi.

Obviously I'm speculating, but it smells right.

@bweir
Copy link
Collaborator

bweir commented Jan 12, 2016

Wooo doggie, I'm gonna have to try this out with my logic analyzer. I'm
rather surprised that it would stop working on 34.4 instead of 33.3, as
that was the version that I made huge, drastic changes to how the loader
works internally. 34.4 made minimal changes to the loader. I'll take a look
at it.
On Jan 11, 2016 3:37 AM, "Philip Howard" notifications@github.com wrote:

I've found a regression between version 0.33.3 and 0.34.4 where uploading
over /dev/ttyAMA0 on the Raspberry Pi 2 no longer seems to work due to our
old friend Mr Timeout.

I've installed both loaders side-by-side on my Pi 2 and here's the output
from each:

From 0.34.4:

pi@raspberrypi ~/propide $ propman-0.34.4 ~/Untitled.binary
pm.loader: [ttyAMA0] Preparing image...
pm.loader: [ttyAMA0] Downloading to RAM...
pm.loader: [ttyAMA0] ERROR: Download timed out

From 0.33.3

pi@raspberrypi ~/propide $ propman ~/Untitled.binary
propeller.manager: opening "ttyAMA0"
propeller.manager: attaching PropellerSession(0x405f68) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x405f68) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x405f68) to "ttyAMA0"
[PropellerManager] ttyAMA0: Downloading image (56 bytes, 441 ms)
[PropellerManager] ttyAMA0: ... 199 ms elapsed
[PropellerManager] ttyAMA0: Verifying RAM
[PropellerManager] ttyAMA0: ... 341 ms elapsed
[PropellerManager] ttyAMA0: DOWNLOAD COMPLETE
propeller.manager: detaching PropellerSession(0x405f68) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x405f68) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x405f68) from "ttyAMA0"
propeller.manager: closing "ttyAMA0"

It dawned on me pretty quickly what the likely problem is, but I'm not
sure I want to believe my own assumption. I'm going to hazard a guess that
the removal of some debug output has caused PropellerManager to speed up to
the point where it's no longer compatible with the Pi.

Obviously I'm speculating, but it smells right.


Reply to this email directly or view it on GitHub
#4.

@bweir
Copy link
Collaborator

bweir commented Jan 19, 2016

Hi Phil, I finally fixed this one. This one surprised even me, as it wasn't an issue with timeouts at all.

I found some bizarre behavior where on every other platform I tried, there was a mysterious 0 byte finding its way into the received data during the handshake, so that when my loader verified the handshake, it was always wrong.

I examined this with a logic analyzer and there was no such byte ever being sent from the Propeller, so I can only imagine it was being introduced by the hardware or by QSerialPort itself, but that begs the question: why now? Why with this release? I'm still baffled by this question.

In any case, this revealed another issue. The QSerialPort clear() command is supposed to empty the transmit and receive buffers, which it simply was not, no matter how hard I tried. Perhaps I incorrectly understand how that command works, but I ended up having to call readAll() before writing the handshake to the device just to make sure that pesky 0 byte did not show up, and this seems to have worked around the problem.

Just another day at LameStation... >.>

Anyway, this build has the fix. Try it out, see what you think:

https://github.com/parallaxinc/PropellerIDE/releases/tag/0.35.0

@bweir bweir closed this as completed Jan 29, 2016
@Gadgetoid
Copy link
Contributor Author

Tried 0.35.1 and 0.36.0 with, strangely, no luck! I reverted back to 0.33.3 again for sanity and it works.

All of this is now on Raspbian Jessie ( Lite ) on the Raspberry Pi Zero, I'll test the new build on the Pi 2 when I get a chance.

Output is as follows:

pi@raspberrypi:~/propeller $ propman test.binary
pm.loader: [ttyAMA0] Preparing image...
pm.loader: [ttyAMA0] Downloading to RAM...
pm.loader: [ttyAMA0] ERROR: Download timed out

vs

pi@raspberrypi:~/propeller $ propman-33.3 test.binary
propeller.manager: opening "ttyAMA0"
propeller.manager: attaching PropellerSession(0x1813f80) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x1813f80) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x1813f80) to "ttyAMA0"
[PropellerManager] ttyAMA0: Downloading image (52 bytes, 439 ms)
[PropellerManager] ttyAMA0:                     ... 201 ms elapsed
[PropellerManager] ttyAMA0: Verifying RAM
[PropellerManager] ttyAMA0:                     ... 346 ms elapsed
[PropellerManager] ttyAMA0: DOWNLOAD COMPLETE
propeller.manager: detaching PropellerSession(0x1813f80) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x1813f80) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x1813f80) from "ttyAMA0"
propeller.manager: closing "ttyAMA0"

Note: The Pi Zero is the same CPU as the Model A and B+, paired with 512MB ram.

@bweir
Copy link
Collaborator

bweir commented Feb 3, 2016

There is some new progress on this. I'll be making a release today.
PropellerManager has been almost entirely rewritten, and this is one issue
that came up so hopefully this one will do the trick.
On Feb 3, 2016 2:26 PM, "Philip Howard" notifications@github.com wrote:

Tried 0.35.1 and 0.36.0 with, strangely, no luck! I reverted back to
0.33.3 again for sanity and it works.

All of this is now on Raspbian Jessie ( Lite ) on the Raspberry Pi Zero,
I'll test the new build on the Pi 2 when I get a chance.

Output is as follows:

pi@raspberrypi:~/propeller $ propman test.binary
pm.loader: [ttyAMA0] Preparing image...
pm.loader: [ttyAMA0] Downloading to RAM...
pm.loader: [ttyAMA0] ERROR: Download timed out

vs

pi@raspberrypi:~/propeller $ propman-33.3 test.binary
propeller.manager: opening "ttyAMA0"
propeller.manager: attaching PropellerSession(0x1813f80) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x1813f80) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x1813f80) to "ttyAMA0"
[PropellerManager] ttyAMA0: Downloading image (52 bytes, 439 ms)
[PropellerManager] ttyAMA0: ... 201 ms elapsed
[PropellerManager] ttyAMA0: Verifying RAM
[PropellerManager] ttyAMA0: ... 346 ms elapsed
[PropellerManager] ttyAMA0: DOWNLOAD COMPLETE
propeller.manager: detaching PropellerSession(0x1813f80) from "ttyAMA0"
propeller.manager: attaching PropellerSession(0x1813f80) to "ttyAMA0"
propeller.manager: detaching PropellerSession(0x1813f80) from "ttyAMA0"
propeller.manager: closing "ttyAMA0"

Note: The Pi Zero is the same CPU as the Model A and B+, paired with 512MB
ram.


Reply to this email directly or view it on GitHub
#4 (comment)
.

@Gadgetoid
Copy link
Contributor Author

Awesome. I'll try it out as soon as I can, but now; sleep! Will keep you posted.

@bweir
Copy link
Collaborator

bweir commented Feb 8, 2016

Hey, check on this again. I went back and fixed mucho mas reset issues. =O

@Gadgetoid
Copy link
Contributor Author

This still appears to be a problem, using the latest Raspbian Jessie, latest Propeller IDE/Propeller Manager and running on the Rapsberry Pi 3 I am unable to program the attached device. I'll have to have another play with the source, but I suspect a hoofing-great-big-delay will fix it. I don't know how on earth such a conditional fix might be deployed for the Pi only.

@Gadgetoid
Copy link
Contributor Author

After further investigation into the Pi 3 problem, I've found it's the weird tinkering with the UART assignments that were required to add Bluetooth. PropellerManager upload functionality can be restored over UART by updating Raspbian ( with sudo apt-get update && sudo apt-get upgrade ) and adding the following to /boot/config.txt:

dtoverlay=pi3-miniuart-bt

There's also another new overlay that allows Bluetooth to be disabled altogether.

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