cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 IoT Discovery Kit: X-CUBE-GCP package Integration with FreeRTOS

Vatsal M
Associate

Hello community,

I am using X-CUBE_GCP package with B-L475E-IOTA discovery kit. I downloaded the package from the ST website and ran the sample code. It worked fine.

Now I have a SAM8Q GPS module (https://www.mikroe.com/gnss-4-click) hooked up at UART4 and a CO-sensor (https://www.spec-sensors.com/product/iot-co-1000-digital-co-sensor-module/) hooked up at USART2 (PA2-->TX PA3-->RX) , both working at a baud rate of 9600bps. I am using STM32CUBEMX to generate initialization code for UART4, USART2 and enable Freertos CMSIS V1.

My main goal is to take GPS and CO sensor data and send it to Google cloud. I am using 3 threads : first thread for GPS, second thread for CO-Sensor and third thread for cloud ( calling cloud_test(0) inside 3rd task). I tried running the FreeRTOS and was able to get GPS and CO sensor data using HAL_Receive_IT(), but my cloud thread fails to allocate memory. I get the below error:

"L #57 net_init() failed: allocation failed"

I searched and found it to be a heap problem. So i increased the heap size for a third thread from 256 to 1024. Yet i am getting the same problem. When i tried initializing the wifi and certificate configuration before starting the scheduler, my code freezes at Wifi initialization.

What is the correct way to integrate FreeRTOS with GCP to send the data to cloud?

#[STM32 MCUs]​ #STM32CubeMX​ #X-CUBE-GCP #FreeRTOS​ #CMSIS​ 

2 REPLIES 2
LMEUN
ST Employee

Hi,

The heap size should be common to all threads and is usually defined in the linker script file.

How much is the heap size of your application now and can you increase it further ?

I kept the heap size as 256 for all the threads and I tried increasing the heap size(Min Heap size) in linker file from 0x11000 to 0x12000, but it did not work. I tried to increase the heap size mentioned in FreeRTOSConfig.h, but it did not work. Any suggestions?