-
Notifications
You must be signed in to change notification settings - Fork 232
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
radio.c update - TX #13
base: master
Are you sure you want to change the base?
Conversation
setting to 1 removes TX errors
Fixed logic setting serial rate.
hi Joe, |
Rewriting my comment from scratch. I have a Beagle Bone Black with a 3DR running 1.9 connected to a serial port, talking to a MacBook Pro with a 3DR radio on a USB port. Config: If I pump characters from the Mac to the BBB as fast as I can, I get no lost data. When I put Joe's patch on the BBB 3DR, I lost much less data. Looking at the signals on the BBB with a login analyzer, they are bizarre -- CTS gets set high but only for 100nS, always just after a rising edge on RX -- clearly something is wrong with my setup. I'll investigate further. I didn't have a pullup on CTS -- now I do, it looks sensible, although I think perhaps the BBB was seeing it correctly before, as I don't see a change in behaviour: sending from the BBB to the MBP still loses about 1/1000 bytes, with Joe's patch. The BBB seems to send as many as 16 bytes after CTS goes high, which should be OK, looking at the threshold and the buffer size. |
I can't remember if I had hardware flow control enabled or not. I did have issue even when just doing RTI5 |
@@ -342,7 +342,7 @@ radio_transmit_simple(__data uint8_t length, __xdata uint8_t * __pdata buf, __pd | |||
// it seems that this gives us an occasional | |||
// fifo overflow error, so put in just 4 bytes | |||
// at a time | |||
n = 4; | |||
n = 1; | |||
if (n > length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the n = 1 assignment, it looks like this "if" statement is rendered ineffective: length != 0 at this point, so n will always be less than or equal to length. Similarly at line 359.
Would anyone mind trying the following test (or its equivalent)? At a5740ee I see intermittent data loss (sequence of missing contiguous bytes) with these settings. I should think that 32Kbps would handle a full rate 9600 bps stream with ECC turned on, even with no RTS/CTS.
S0:FORMAT=25 |
@joeman155, the application note at http://www.silabs.com/Support%20Documents/TechnicalDocs/AN440.pdf (page 7) confirms that with the threshold at 60, itxffafull will not go high until after crossing 60. I also wonder how much latency there is in the status flag updates. |
@tgdavies , when you ran your BBB test, it looks like you had both ends the same serial baud rate? If so, running a full rate stream could cause buffer overflows without RTS/CTS since one serial clock will be running slightly faster than the other. Even so, I agree that in theory there should be ways to set up the radios where a full rate stream ought to work without RTS/CTS. |
@ldslaron 1 character in 1000 (which is what I was losing) does seem consistent with a small clock mismatch -- end would explain why I only saw the loss in one direction. I believe that I had hardware flow control working on both ends (once I had configured my pullup correctly on the BBB) so I would expect not to lose characters even with the mismatch. |
@tgdavies, yes, I feel like there may still be a problem in the codebase that causes intermittent data loss. I've been experimenting with the use of a ping pong buffer in the RX interrupt handler so the TDM code doesn't have to service the buffer before the next packet starts coming in, but I'm not sure if that is the problem. |
@ldslaron Thanks -- I will try that when I give this project another timeslice and let you know how it goes. |
Hello,
Ignore the commit to serial.c. The pull request is being sent because of changes to radio.c
I've found that I got TX errors without the suggested changes. (I was sending large packets of data...132 byte x-modem packets)
I noticed comments about how the FIFO was 'sensitive' about how fast data was put in...so this is why I tried making changes here...thought we might still be pushing it a bit too much.
I thought I'd try and guess what was going on. Perhaps the issue might be be related to the fact that it jumps from 60 to 64 and somehow...it can't deal with numbers that require 7th bit. So rather than trying to reduce the almost full threshold...I thought I'd increment by one...so it gets to 61 (and never reaches 64) and THEN the radio starts transmitting.
NOTE: The docs :
http://www.silabs.com/Support%20Documents/TechnicalDocs/Si1000.pdf
(page 264) says:-
"When the data being filled into the TX FIFO crosses this threshold limit,an interrupt to the microcontroller is generated so the chip can enter TX mode to transmit the contents of the TX FIFO."
Note the word 'crosses'. i.e. Being at 60 does not trigger it. So if we pile in enough data quickly...we get it up to 64.
Anyhow, I'll leave it at that. It 'seems' to resolve issues...but I can't explain it.