Cascoda / ca8210-linux

Linux kernel driver for direct SPI communication with Cascoda's CA-8210 IEEE 802.15.4 transceiver
BSD 3-Clause "New" or "Revised" License
5 stars 5 forks source link

Driver discards bytes received during transmit #5

Closed tgillbe closed 7 years ago

tgillbe commented 7 years ago

I've encountered a situation where the driver discards bytes received while transmitting a message.

The sequence of events are as follows:

Device A sets AUTED flag to 0 (with TDME_SETSFR_request_sync). Device A sends ping request to device B (with MCPS_DATA_request). Device A sets AUTED flag to 1 (with TDME_SETSFR_request_sync). Device A waits for ping response from device B (through MCPS_DATA_indication callback). Device A reads EDVALLP register.

Device B hears ping request (with MCPS_DATA_indication). Device B sends ping response to device A (with MCPS_DATA_request).

Unfortunately I cannot reliably reproduce this error as it occurs very sporadically, anywhere from after an hour, to after 30 secs of this procedure running in a loop.

The kernel messages (for device A) are as follows:

[ 8201.452057] ca8210 spi0.0: ca8210_spi_write called
[ 8201.452084] ca8210 spi0.0: device_comm: command ID = 0x51 length = 0x3 Data:
[ 8201.452094] ca8210 spi0.0: 0x0
[ 8201.452104] ca8210 spi0.0: 0xb2
[ 8201.452114] ca8210 spi0.0: 0x8
[ 8201.453256] ca8210 spi0.0: irq: Interrupt occured
[ 8201.453276] ca8210 spi0.0: irq: Servicing interrupt
[ 8201.453341] ca8210 spi0.0: ca8210_spi_read called
[ 8201.453830] ca8210 spi0.0: spi received during transfer:
[ 8201.453850] ca8210 spi0.0: 0xff
[ 8201.453860] ca8210 spi0.0: 0xff
[ 8201.453869] ca8210 spi0.0: 0xff
[ 8201.453879] ca8210 spi0.0: 0x20
[ 8201.453888] ca8210 spi0.0: 0x1f
[ 8201.453960] ca8210 spi0.0: irq: Interrupt occured
[ 8201.453989] ca8210 spi0.0: spi received cmdid: 240, len: 255
[ 8201.454001] ca8210 spi0.0: spi: writing dummy packet
[ 8201.454031] ca8210 spi0.0: spi: wrote dummy packet
[ 8201.468728] ca8210 spi0.0: spi read retry 1...
[ 8201.468749] ca8210 spi0.0: ca8210_spi_read called
[ 8201.468806] ca8210 spi0.0: spi received cmdid: 255, len: 255
[ 8201.468817] ca8210 spi0.0: spi: writing dummy packet
[ 8201.468845] ca8210 spi0.0: spi: wrote dummy packet
[ 8201.468858] ca8210 spi0.0: spi read failed, returned -52

The 0x20 and 0x1f bytes are subsequently ignored by the driver, putting it out of sync.

tgillbe commented 7 years ago

I haven't seen this issue since moving to baf5afb1176ae51c41d76f5a30412c89dd15bca2, appears to be fixed.