The cc2420 takes care about inserting the preamble sequence and the SFD in
hardware. The first byte you need to insert into the FIFO is is the length byte
for the MPDU. Without this the first byte of FCF was used as length. This
results in wrong information about length FCF and more. Thefore the whole
package looks destroyed on the air.

With this patch packets sniffed from the air and decoded with wireshark are
having the expected content and FCS.

Signed-off-by: Stefan Schmidt <ste...@datenfreihafen.org>
---
 drivers/ieee802154/cc2420.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/ieee802154/cc2420.c b/drivers/ieee802154/cc2420.c
index a23cc96..fd072ce 100644
--- a/drivers/ieee802154/cc2420.c
+++ b/drivers/ieee802154/cc2420.c
@@ -219,6 +219,10 @@ cc2420_write_txfifo(struct cc2420_local *lp, u8 *data, u8 
len)
                .tx_buf         = lp->buf,
                .rx_buf         = lp->buf,
        };
+       struct spi_transfer xfer_len = {
+               .len            = 1,
+               .tx_buf         = &len,
+       };
        struct spi_transfer xfer_buf = {
                .len            = len,
                .tx_buf         = data,
@@ -230,6 +234,7 @@ cc2420_write_txfifo(struct cc2420_local *lp, u8 *data, u8 
len)
 
        spi_message_init(&msg);
        spi_message_add_tail(&xfer_head, &msg);
+       spi_message_add_tail(&xfer_len, &msg);
        spi_message_add_tail(&xfer_buf, &msg);
 
        status = spi_sync(lp->spi, &msg);
-- 
1.7.1


------------------------------------------------------------------------------
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to