Prototype RF driver for STM Sub-1 GHz RF expansion board based on the SPSGRF-868 module for STM32 Nucleo.
Prototype RF Driver for STM Sub-1 GHz RF Expansion Boards based on the SPSGRF-868 and SPSGRF-915 Modules for STM32 Nucleo
Currently supported boards:
Note, in order to use expansion board X-NUCLEO-IDS01A4 in mbed you need to perform the following HW modifications on the board:
- Unmount resistor
R4 - Mount resistor
R7
Furthermore, on some Nucleo development boards (e.g. the NUCLEO_F429ZI), in order to be able to use Ethernet together with these Sub-1 GHz RF expansion boards, you need to compile this driver with macro SPIRIT1_SPI_MOSI=PB_5 defined, while the development board typically requires some HW modification as e.g. described here!
This driver can be used together with the 6LoWPAN stack (a.k.a. Nanostack).
Diff: mbed_driver_api.cpp
- Revision:
- 25:2ec45788f28c
- Parent:
- 24:03e351bfc9c9
- Child:
- 27:e68ffb6ac223
--- a/mbed_driver_api.cpp Thu Nov 10 15:25:59 2016 +0100
+++ b/mbed_driver_api.cpp Mon Nov 14 11:26:03 2016 +0100
@@ -138,10 +138,12 @@
/*Store TX handle*/
mac_tx_handle = tx_handle;
- tr_debug("%s (%d), len=%d, tx_handle=%x, tx_seq=%x, need_ack=%d (%x:%x, %x:%x, %x:%x, %x:%x)", __func__, __LINE__,
+// #ifdef HEAVY_TRACING
+ tr_info("%s (%d), len=%d, tx_handle=%x, tx_seq=%x, need_ack=%d (%x:%x, %x:%x, %x:%x, %x:%x)", __func__, __LINE__,
data_length, tx_handle, tx_sequence, need_ack,
data_ptr[3], data_ptr[4], data_ptr[5], data_ptr[6],
data_ptr[7], data_ptr[8], data_ptr[9], data_ptr[10]);
+// #endif
/*Send the packet*/
rf_device->send(data_ptr, data_length);
@@ -335,9 +337,9 @@
uint8_t src_addr_mode = 0x0; /*0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */
uint8_t min_size = 3; // FCF & SeqNr
bool ret = false;
-#if !defined(SHORT_ACK_FRAMES) || defined(HEAVY_TRACING)
+// #if !defined(SHORT_ACK_FRAMES) || defined(HEAVY_TRACING)
bool panid_compr = false;
-#endif
+// #endif
if(len < 3) {
tr_debug("%s (%d)", __func__, __LINE__);
@@ -353,10 +355,10 @@
panid_compr = ((fcf & MAC_FCF_INTRA_PANID_MASK) >> MAC_FCF_INTRA_PANID_SHIFT);
#endif
-#ifdef HEAVY_TRACING
- tr_debug("%s (%d): len=%d, ftype=%x, snr=%x, ack=%d, dst=%x, src=%x, intra=%d", __func__, __LINE__, len, frame_type,
+// #ifdef HEAVY_TRACING
+ tr_info("%s (%d): len=%d, ftype=%x, snr=%x, ack=%d, dst=%x, src=%x, intra=%d", __func__, __LINE__, len, frame_type,
rf_rx_buf[2], (*ack_requested), dst_addr_mode, src_addr_mode, panid_compr);
-#endif
+// #endif
if(frame_type == FC_ACK_FRAME) { // betzw: we support up to two different forms of ACK frames!
#ifdef SHORT_ACK_FRAMES
@@ -542,7 +544,7 @@
}
#ifdef HEAVY_TRACING
- tr_debug("%s (%d), ret=%d, ack=%d", __func__, __LINE__, ret, (*ack_requested));
+ tr_info("%s (%d), ret=%d, ack=%d", __func__, __LINE__, ret, (*ack_requested));
#endif
return ret;
}
@@ -565,7 +567,11 @@
if(!rf_buffer_len)
return;
- /* Check if packet should be accepted */
+#ifdef HEAVY_TRACING
+ tr_debug("%s (%d)", __func__, __LINE__);
+#endif
+
+ /* Check if packet should be accepted */
if(!rf_check_destination(rf_buffer_len, &ack_requested)) {
#ifdef HEAVY_TRACING
tr_debug("%s (%d)", __func__, __LINE__);
X-NUCLEO-IDS01A4 Sub-1GHz RF Expansion Board