The great thing with Processor Expert is: it writes the code for me :-). I’m using now the RNet wireless stack in more than 10 different projects, and keeping the projects up-to-date with the RNet stack sources in a traditional way gets harder and harder: I need to make sure the paths are pointing to the right place, and if I pass the project to somebody else, I have to make sure all the sources are packaged with that project. Processor Expert makes things simpler: it can generate the source files into my project, and I can easily configure it.
So instead to copy and support files by hand, I decided to package the RNet stack files into a Processor Expert component: all still normal C files, but easier to configure and distribute.
RNet Component
The component has several properties: to select the transceiver and to configure the Shell with or without the standard I/O redirection:
Based on the settings, the source files are copied/generated and properly configured. If you still want to have the ‘normal’ C sources, they are on GitHub here: https://github.com/ErichStyger/McuOnEclipse_PEx
Simple Demo Application
I have contributed a simple demo application for the nRF24L01+ transceiver with the Freesale FRDM-KL25Z board: it remaps the reset button as normal push buttons: depending on how long the button is pressed, it sends a ‘1’ or a ‘2’ to the network as broadcast message which toggles a LED on the receiver side (Application.c):
static void CheckKey(void) { uint16_t cnt; uint8_t data; if (SW1_GetVal()==0) { /* low active */ WAIT1_WaitOSms(50); /* simple debounce */ if (SW1_GetVal()==0) { /* still pressed? */ cnt = 0; while(SW1_GetVal()==0) { /* wait until released */ WAIT1_WaitOSms(10); cnt += 10; } if (cnt>1000) { /* long press */ data = 2; /* toggle LED2 */ } else { data = 1; /* toggle LED1 */ } (void)RAPP_SendPayloadDataBlock(&data, sizeof(data), RAPP_MSG_TYPE_DATA, RNWK_ADDR_BROADCAST, RPHY_PACKET_FLAGS_NONE); } } }On the receiver side (RNet_App.c), it checks the data transmitted, and toggles a LED:
static uint8_t RNETA_HandleRxMessage(RAPP_MSG_Type type, uint8_t size, uint8_t *data, RNWK_ShortAddrType srcAddr, bool *handled, RPHY_PacketDesc *packet) { uint8_t val; (void)srcAddr; (void)packet; switch(type) { case RAPP_MSG_TYPE_DATA: /* <type><size><data */ *handled = TRUE; val = *data; /* get data from packet */ if (val==1) { LED1_Neg(); } else if (val==2) { LED2_Neg(); } else if (val==3) { LED3_Neg(); } return ERR_OK; default: break; } /* switch */ return ERR_OK; }nRF24L01+ Component
Not directly related to the RNet stack, but worthwhile to mention: the properties of the nRF24L01+ component have been extended:
- I can now use a Software SPI (bit-banging with normal General Purpose I/O pins)
- To switch and share the SPI bus with other devices, it is needed to have hooks. For this an option enables this, along with the possibility to change the SPI clock frequency.
With this, there are two additional event hooks which can be used e.g. with a Semaphore/Mutex to guard access to the SPI bus.
Additionally, the method ConstantCarrierWave() has been added: I needed that transceiver functionality for EMI and wireless communication band compliance testing with the authorities at the TÜV.
Summary
The RNet component for sure can be extended even more. Right now it includes the Nordic Semiconductor nRF24L01+ transceiver, and I will add the Freescale MC13201 transceiver shortly, along with more configuration settings. The new files are available on GitHub:
- Updated component(s): https://sourceforge.net/projects/mcuoneclipse/
- Example project with Shell and Std I/O redirection: https://github.com/ErichStyger/mcuoneclipse
- Simple example, pressing a push button sends a message with data: https://github.com/ErichStyger/mcuoneclipse
Happy RNeting 🙂
Erich,
I downloaded your Rnet stack for the radios and I found several files corrupted
from the GitHub account.
See for your self.
Look inside the Radio.c file.
There are more corrupted.
Just to let you know.
By the way nice work on the stacks.
LikeLike
Hello,
I just checked
https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/RNet/SMAC/Radio.c
and
https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/RNet/nRF24/Radio.c
and they look fine?
If you refer to the files in
https://github.com/ErichStyger/mcuoneclipse/tree/master/Drivers/RNet
then these are not ‘normal’ C files, these are driver files for Processor Expert. Maybe this is the confusion?
LikeLike
Erich,
Thank you for the clarification.
Yes, that make sense now.
Thank you for making the stacks available to use.
LikeLike
Pingback: FTF: FRDM-K64F, Kinetis Design Studio and Kinetis SDK | MCU on Eclipse
Pingback: JoyStick Shield with the FRDM Board | MCU on Eclipse
Pingback: Enhanced RNet Wireless Components and Communication Stack | MCU on Eclipse
Pingback: New Zumo Robot PCB’s Arrived! | MCU on Eclipse
Pingback: nRF24L01+ 2.4 GHz Wireless Connectivity with the tinyK20 Board | MCU on Eclipse
Hi Erich
I download the examples FRDM-KL25Z_RNet_component and FRDM-KL25Z_RNet_Simple and try it but get the folowing erros:
Description Resource Path Location Type
mingw32-make: *** [Sources/Shell.o] Error 1 FRDM-KL25Z_RNet_Component C/C++ Problem
mingw32-make: *** [Sources/RNet_App.o] Error 1 FRDM-KL25Z_RNet_Component C/C++ Problem
mingw32-make: *** Waiting for unfinished jobs…. FRDM-KL25Z_RNet_Component C/C++ Problem
mingw32-make: *** [Sources/Application.o] Error 1 FRDM-KL25Z_RNet_Component C/C++ Problem
‘portTICK_RATE_MS’ undeclared (first use in this function) Shell.c /FRDM-KL25Z_RNet_Component/Sources line 58 C/C++ Problem
unknown type name ‘portTickType’ RNet_App.c /FRDM-KL25Z_RNet_Component/Sources line 59 C/C++ Problem
‘portTICK_RATE_MS’ undeclared (first use in this function) RNet_App.c /FRDM-KL25Z_RNet_Component/Sources line 62 C/C++ Problem
‘portTICK_RATE_MS’ undeclared (first use in this function) Application.c /FRDM-KL25Z_RNet_Component/Sources line 30 C/C++ Problem
‘portTICK_RATE_MS’ undeclared (first use in this function) RNet_App.c /FRDM-KL25Z_RNet_Component/Sources line 106 C/C++ Problem
‘xTaskHandle’ undeclared (first use in this function) expected expression before ‘)’ token RNet_App.c /FRDM-KL25Z_RNet_Component/Sources line 115 C/C++ Problem
‘xTaskHandle’ undeclared (first use in this function) expected expression before ‘)’ token Application.c /FRDM-KL25Z_RNet_Component/Sources line 40 C/C++ Problem
Could you help Please!
LikeLike
Thanks for reporting! The issue is that these projects have not been updated for the latest FreeRTOS API, as they still use the ‘legacy’ ones.
I have now updated the projects, please see the following commit: https://github.com/ErichStyger/mcuoneclipse/commit/d8da13947d5f1bc8c0b423c2c518e211839f6c3d
LikeLike
Thanks Erich
!It work!
LikeLike
great! Thanks for closing the loop!
LikeLike