times in events... #754
Replies: 3 comments
-
Posted at 2015-05-28 by @gfwilliams Not sure I understand - what lengths should it be reporting back? What if you attach it to something like a PWM output that you know the frequency of? Also, is this the Espruino Board, or the Pico? Just tried this on the Pico:
and In fact you can check, because if you warm the chip up that number changes drastically. I think the only solution is to actually 'trim' the internal RC oscillator based on the external high speed crystal (which is relatively accurate) - I just haven't got around to adding the code for that yet. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-28 by DrAzzy It's the Pico. It should be reporting back lengths of around 0.00055 and 0.0003. So it's off by ~50%, plus a ton of jitter... Instead, well, look at the values it's reporting - all those numbers above the two parserx outputs (where it gets a packet that doesn't match what was sent) are bits! Consistently smaller, and the longest reported lengths for zeros are longer than the shortest reported lengths of the ones. (bitstream should be 1FE10018 - the last nybble is the checksum, which the arduino receiver filters out) 00011111 11101000 00000000 00011000 On arduino based receiver, I count 0.12-0.40 ms as 0, 0.45-0.75 as 1. I wonder if this is responsible for the problem that guy recently had with HC-SR04 reading consistently low? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-28 by @gfwilliams Hmm... That is particularly far out - I wouldn't have thought the oscillator would be that bad! You're doing Depending on the signal, it could also be reporting differently because it'll be running with 3.3v logic levels, and Arduino with 5v ones. Might be interesting to try the code I posted above though (or similar)? Just to get an idea of how far off the oscillator really is. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-28 by DrAzzy
Right now, the times reported for things in events are... uh.... wrong.
On an Arduino, clocked off a crystal, I can constrain the 1 and 0 lengths like so:
The Arduino receiver happily takes the transmission and yields the correct result. With no interrupts or hardware timing more advanced than micros():
+1FE10001
Now, let's look at what lengths we get for those under Espruino:
Note how the numbers are all WAY LOWER than they should be. Those decoding results are after I lowered the threshold for 0 vs 1 down to 0.000295, in an attempt to get everything out of the 0 range, and widened the threshold for accepting, ie:
This is with analog squelching, by the way - it works splendidly. I can still receive without it - and it doesn't change the fact that the times are all over the place and consistently way under what they should be.
Beta Was this translation helpful? Give feedback.
All reactions