saunwin Active Member Licensed User Longtime User Sep 18, 2021 #1 Hi, Using FELusbserial to send and recieve a few bytes. I noticed that when sending a byte a random number of DataAvailable events are fired, with what looks like no data bytes. so I send 62, 62, 64 and 54 and dataAvailable logs empty data. I'm also dropping bytes even though I'm looping in the dataAvailable routine From 0 To Buffer.length-1. Any advise here ? TIA Send a byte B4X: tx = 62 'send 0x62 thru serial port t = bc.HexToBytes(tx) If usbserial.IsInitialized Then usbserial.Write(t) Receiving bytes B4X: Private Sub serial_DataAvailable (Buffer() As Byte) Log("New data: " & bc.HexFromBytes(Buffer))
Hi, Using FELusbserial to send and recieve a few bytes. I noticed that when sending a byte a random number of DataAvailable events are fired, with what looks like no data bytes. so I send 62, 62, 64 and 54 and dataAvailable logs empty data. I'm also dropping bytes even though I'm looping in the dataAvailable routine From 0 To Buffer.length-1. Any advise here ? TIA Send a byte B4X: tx = 62 'send 0x62 thru serial port t = bc.HexToBytes(tx) If usbserial.IsInitialized Then usbserial.Write(t) Receiving bytes B4X: Private Sub serial_DataAvailable (Buffer() As Byte) Log("New data: " & bc.HexFromBytes(Buffer))
Erel B4X founder Staff member Licensed User Longtime User Sep 19, 2021 #2 What is the output of: Code: Log(Buffer.Length) ? The event is raised whenever the underlying driver calls the read callback. It shouldn't be raised with no data. Which type of serial device are you using? Upvote 0
What is the output of: Code: Log(Buffer.Length) ? The event is raised whenever the underlying driver calls the read callback. It shouldn't be raised with no data. Which type of serial device are you using?
saunwin Active Member Licensed User Longtime User Sep 19, 2021 #3 Thanks for the reply Erel. B4X: Log ("Buffer Length "& (Buffer.length)) The above line returns zero. So this is normal ? - I'm using the Si Labs 2102 Upvote 0
Thanks for the reply Erel. B4X: Log ("Buffer Length "& (Buffer.length)) The above line returns zero. So this is normal ? - I'm using the Si Labs 2102
Erel B4X founder Staff member Licensed User Longtime User Sep 19, 2021 #4 No. I guess that felUsbSerial detects it as a FTDI chip and doesn't handle the data properly. Worth trying with UsbSerial. Upvote 0
No. I guess that felUsbSerial detects it as a FTDI chip and doesn't handle the data properly. Worth trying with UsbSerial.
saunwin Active Member Licensed User Longtime User Sep 19, 2021 #5 OK, this is weird. My tablet (Tangotab) has two USB ports (a USB A and an OTG). The OTG appears to work fine. The full size USB A drops bytes and produces dataavailable events with no data. Thank you for replying Erel. Upvote 0
OK, this is weird. My tablet (Tangotab) has two USB ports (a USB A and an OTG). The OTG appears to work fine. The full size USB A drops bytes and produces dataavailable events with no data. Thank you for replying Erel.