Interfacing external sensors with I-CUBE-LRWN

I’ve interfaced my RFM95 LoRa module with the STM32L476RG Nucleo board, using the I-CUBE-LRWN library to send uplink messages with dummy data and temperature values. However, I can’t locate the .ioc file in the library to configure the pinouts for my external sensors. Could you help me find the .ioc file in this library, and let me know which file to modify to add sensor values and customize the payload?

It depends on how you created the project - did you copy it out of the library or did you generate an initial project based on the I-CUBE-LW library or from the STM32L476 board?

If you used CubeMX then the .ioc is generally in the top level of the project folder and is listed in the file browser in CubeIDE.

As well as defining the IO, you’ll need to add the drivers for the sensors and then some code to read the sensors and then add them to the payload.

You say you are now sending dummy data and temperature values - this implies you have already found the place where the payload is constructed.

I’ll be happy to assist with this, I am quite familiar with the I-CUBE-LW setup, but first I’d appreciate an answer to Porting STM32WL LoRaWAN to STM32L476RG - #5 by descartes so that I have some context.

It would also be useful to know if you’ve used STM32, LoRaWAN and LoRaMac-node before.

Thank you for the response! To answer your question—yes, I have downloaded the complete end-node code, built it, and flashed it to my STM32L476RG Nucleo board, attached the RFM95 module, and successfully tested it with my gateway and TTN. The uplink payloads with dummy messages are working as expected. I didn’t add any additional libraries or use CubeMX; the code already included dummy temperature values.

Now, I’m looking to interface my magnetometer via I2C and construct a custom payload. I found a file that might be responsible for payload construction, but it’s not entirely clear if this is the correct file, as the library was originally set up to use Cayenne MyDevices as the platform server. Unfortunately, Cayenne is no longer operational.

And yes, I’m familiar how Lorawan works, how gateways works and how end nodes works.

Unfortunately, there is no .ioc file in the whole I-CUBE-LRWN library.

Please go back through my response and action/answer all the questions I asked. Then I’ll have the information to help you properly.

I recently downloaded the I-CUBE-LW library, which provides a complete end-node library for the STM32L476RG with an SX1276-based expansion board. I compiled the library in STM32CubeIDE and flashed it directly to my L476RG board, which has an RFM95 module connected via SPI. I didn’t use STM32CubeMX, as the I-CUBE-LW library doesn’t include an .ioc file for any board.

I’m still trying to locate the file where the payload is constructed, as I’m currently receiving dummy temperature values on the Putty serial console. Additionally, I didn’t use any WL-based end-node libraries; I specifically used I-CUBE-LW for the STM32L476RG with the RFM95 module, so I didn’t need to port anything into the library. Lastly, I’m familiar with STM32 and LoRaWAN integration.

Wondering if you can answer the questions on the other topic, as requested above.

These were asked for a very good reason, restoring projects from two+ years back to see how I did it is non-trivial and if you have better choices for more up to date hardware, in this case, an SX126X board of some sort, you can have up to date code rather than what is a rapidly dating LoRaMac-node implementation.

There never was any .ioc files for I-CUBE_LRWAN - it’s original construction predates CubeMX - but you can create one for the L476 but I’d need to see the archived projects to see how I then integrated the LoRaWAN files in to the project - which with the include path setup is a hot mess.

I’m still a bit confused that if you’ve found the part where the payload is built using the Cayenne encoding, which still has it’s place even if the service has been stopped, why you need to know where the payload is built.