From 825707b35532936c1599f454a5b6c0a57ea6f6b6 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 4 Apr 2016 10:14:57 -0500 Subject: [PATCH] prevent overflow of incoming rf data into packet buffer --- Readme.md | 8 ++++++++ radio.c | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 0e047e6..904d11b 100644 --- a/Readme.md +++ b/Readme.md @@ -29,6 +29,14 @@ pump model number ends with 'WW' then you need a 'WorldWide' firmware: make -f Makefile.uart1_alt2 RADIO_LOCALE=WW +# cc111x UART1_alt2 connected to the Intel Edison UART_1 + + P1.4 - CT / SSN -> UART_1_RTS (GP129) (pin 63) + P1.5 - RT / SCK -> UART_1_CTS (GP128) (pin 65) + P1.6 - TX / MOSI -> UART_1_RX (GP130) (pin 61) + P1.7 - RX / MISO -> UART_1_TX (GP131) (pin 46) + + # UART on the WirelessThings ERF stick Perform the build. The output file will be stored at output/uart0_alt1_SRF_ERF_US/uart0_alt1_SRF_ERF_US.hex diff --git a/radio.c b/radio.c index 963520e..19ed592 100644 --- a/radio.c +++ b/radio.c @@ -89,8 +89,12 @@ void rftxrx_isr(void) __interrupt RFTXRX_VECTOR { if (packet_count == 0) { packet_count = 1; } - radio_rx_buf[radio_rx_buf_len] = d_byte; - radio_rx_buf_len++; + if (radio_rx_buf_len < MAX_PACKET_LEN) { + radio_rx_buf[radio_rx_buf_len] = d_byte; + radio_rx_buf_len++; + } else { + // Overflow + } if (d_byte == 0) { RFST = RFST_SIDLE; while(MARCSTATE!=MARC_STATE_IDLE);