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).

Files at this revision

API Documentation at this revision

Comitter:
Wolfgang Betz
Date:
Fri Oct 14 10:42:56 2016 +0200
Parent:
1:260f79310518
Child:
3:0df38cfb1e53
Commit message:
Run thru initialization

Changed in this revision

SimpleSpirit1.cpp Show annotated file Show diff for this revision Revisions of this file
SimpleSpirit1.h Show annotated file Show diff for this revision Revisions of this file
libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Types.c Show annotated file Show diff for this revision Revisions of this file
mbed_lib.json Show annotated file Show diff for this revision Revisions of this file
--- a/SimpleSpirit1.cpp	Fri Oct 14 08:57:51 2016 +0200
+++ b/SimpleSpirit1.cpp	Fri Oct 14 10:42:56 2016 +0200
@@ -32,10 +32,12 @@
     /* configure spi */
     _spi.format(8, 0); /* 8-bit, mode = 0, [order = SPI_MSB] only available in mbed3 */
     _spi.frequency(5000000); // 5MHz
+}
 
+void SimpleSpirit1::init() {
     /* set frequencies */
     radio_set_xtal_freq(XTAL_FREQUENCY);
-    mgmt_set_freq_base(XTAL_FREQUENCY);
+    mgmt_set_freq_base((uint32_t)BASE_FREQUENCY);
 
     /* restart board */
     enter_shutdown();
--- a/SimpleSpirit1.h	Fri Oct 14 08:57:51 2016 +0200
+++ b/SimpleSpirit1.h	Fri Oct 14 10:42:56 2016 +0200
@@ -26,7 +26,7 @@
 	static SimpleSpirit1 *_singleton;
 
     /** Communication Interface Instance Variables **/
-	SPI _spi; // betzw - NOTE: Arduino pins are valid for NUCLEO-F401RE
+	SPI _spi; // betzw - NOTE: Arduino pins are valid only for NUCLEO-F401RE
               // mosi: PA_7 (D11)
               // miso: PA_6 (D12)
               // sclk: PB_3 (D3) or
@@ -36,10 +36,10 @@
               // mode: 0
               // ordr: MSB
               // freq: max 10MHz
-    InterruptIn _irq; // PC_7 (falling)
-    DigitalOut _chip_select; // PB_6 ('1' == chip unselected)
-    DigitalOut _shut_down; // PA_10 ('1' == shut_down) 
-    DigitalOut _led; // PB_4 (optional)
+    InterruptIn _irq; // PC_7 (D9) (falling)
+    DigitalOut _chip_select; // PB_6 (D10) ('1' == chip unselected)
+    DigitalOut _shut_down; // PA_10 (D2) ('1' == shut_down)
+    DigitalOut _led; // PB_4 (D5) (optional)
 
     /** Static Variables from Cube Implementation **/
     /*
@@ -193,6 +193,9 @@
     	enable_irq();
     }
 
+    /** Init Instance Method **/
+    void init(void);
+
     /** Constructor **/
     SimpleSpirit1(PinName mosi, PinName miso, PinName sclk,
 		  PinName irq, PinName cs, PinName sdn,
@@ -209,8 +212,9 @@
     	if(_singleton == NULL) {
     		_singleton = new SimpleSpirit1(mosi, miso, sclk,
     				irq, cs, sdn, led);
+    		_singleton->init();
     	} else {
-    		error("SimpleSpirit1 singleton already created!");
+    		error("SimpleSpirit1 singleton already created!\n");
     	}
 
     	return *_singleton;
@@ -218,7 +222,7 @@
 
     static SimpleSpirit1& Instance() {
     	if(_singleton == NULL) {
-    		error("SimpleSpirit1 must be created before used!");
+    		error("SimpleSpirit1 must be created before used!\n");
     	}
 
     	return *_singleton;
--- a/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Types.c	Fri Oct 14 08:57:51 2016 +0200
+++ b/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Types.c	Fri Oct 14 10:42:56 2016 +0200
@@ -129,7 +129,7 @@
 void s_assert_failed(uint8_t* file, uint32_t line)
 {
   /* User can add his own implementation to report the file name and line number */
-  printf("Wrong parameters value: file %s on line %d\r\n", file, line);
+  printf("Wrong parameters value: file %s on line %d\r\n", file, (int)line);
 
   /* Infinite loop */
   while (1)
--- a/mbed_lib.json	Fri Oct 14 08:57:51 2016 +0200
+++ b/mbed_lib.json	Fri Oct 14 10:42:56 2016 +0200
@@ -1,4 +1,4 @@
 {
     "name": "myspirit1",
-    "macros": ["USE_STM32F4XX_NUCLEO", "X_NUCLEO_IDS01A4"]
+    "macros": ["USE_STM32F4XX_NUCLEO", "X_NUCLEO_IDS01A4", "SPIRIT_USE_FULL_ASSERT"]
 }