Mario Sonnenberg

Porting PingPong project from I-Cube-LRWAN to a thread-based FreeRTOS project

Discussion created by Mario Sonnenberg on Oct 26, 2017
Latest reply on Jan 9, 2018 by Nicolas Hell

nucleo-l073rzsx1272i-cube-lrwanp-nucleo-lrwan1

Used Hardware: P-NUCLEO-LRWAN1 (Nucleo-L073RZ and SX1272MB2DAS)

Used Software: CubeMX, OpenStm32 (SW4STM32 toolchain), I-CUBE-LRWAN)

 

Hallo together,

I have a problem to build a project that combines FreeRTOS with the Ping Pong example-project from the I-CUBE-LRWAN expansion pack. The goal of my current work is a thread-based ping-pong project running on two nodes and exchanging messages.  Therefore, I have created a new SW4STM32-toolchain project in CubeMx for the Nucleo-L073RZ board that includes FreeRTOS. After that, I have opened the project in the OpenStm32-IDE and have added the LoRa-middleware and the SX1272MB2DAS drivers from the I-CUBE-LRWAN expansion pack to the project. At this state, the project could not be compiled and there were a lot of errors. After adding the required files from the ping pong project and adjusting the includes and compiler settings, the project could be compiled. At this state, threading works well (the scheduler could switch between two threads, a default and a blinking LED thread). Then I have created a LoRa-ping-pong thread with the ping pong code of the I-CUBE-LRWAN expansion pack. The project is still able to be compiled, but there is a problem with unexpected interrupts, because the control flow ends in the infinity loop of the default handler. After debugging, I have found out that the following code snippet, executing before initializing the threads, cause the problems. I hope that someone could help me to get the project running or shows me a better way combining a RTOS with the ping pong project. (I have append my current project)

 

static RadioEvents_t RadioEvents;

                  RadioEvents.TxDone = OnTxDone;

                  RadioEvents.RxDone = OnRxDone;

                  RadioEvents.TxTimeout = OnTxTimeout;

                  RadioEvents.RxTimeout = OnRxTimeout;

                  RadioEvents.RxError = OnRxError;

                  Radio.Init( &RadioEvents );

                  Radio.SetChannel( RF_FREQUENCY );

 

                #if defined( USE_MODEM_LORA )

                  Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,

                                                 LORA_SPREADING_FACTOR, LORA_CODINGRATE,

                                                   LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,

                                                   true, 0, 0, LORA_IQ_INVERSION_ON, 3000000 );

                  Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,

                                                   LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,

                                                   LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,

                                                   0, true, 0, 0, LORA_IQ_INVERSION_ON, true );

 

                #elif defined( USE_MODEM_FSK )

                  Radio.SetTxConfig( MODEM_FSK, TX_OUTPUT_POWER, FSK_FDEV, 0,

                                                  FSK_DATARATE, 0,

                                                  FSK_PREAMBLE_LENGTH, FSK_FIX_LENGTH_PAYLOAD_ON,

                                                  true, 0, 0, 0, 3000000 );

                  Radio.SetRxConfig( MODEM_FSK, FSK_BANDWIDTH, FSK_DATARATE,

                                                  0, FSK_AFC_BANDWIDTH, FSK_PREAMBLE_LENGTH,

                                                  0, FSK_FIX_LENGTH_PAYLOAD_ON, 0, true,

                                                  0, 0,false, true );

 

                #else

                    #error "Please define a frequency band in the compiler options."

                #endif

 

                 Radio.Rx( RX_TIMEOUT_VALUE );

Attachments

Outcomes