2020-11-10 10:10 AM
Hello,
So I bought a B-L4S5I-IOT01A with the intention to use it as a MQTT device to send and receive data. My problem is that i cannot communicate with the on board Wi-Fi chip "STM32_IWIN_WIFI_V2". Here's what I did :
1- I create a project with STM32CubeMX for STM32CubeIDE, and added FreeRTOS (because I plant to use it in my finished project), and initialized all the peripherals to default. And made sure that UART3 (the Wi-Fi chip com port) was configured with the proper default parameters.
2- Then I added a library called "STM32_IWIN_WIFI_V2" that I found on the Wi-Fi chip manufacturer web site. It's basically a UART wrapper to help interface with the chip. Originally this library is meant for STM32F4, but since it only called HAL_UART so I went ahead and modified #include for STM32L4.
3 - I used a demo program supposed to connect to a Wi-Fi network and post messages about it on the StLink uart port.
4- It didn't work... The MCU could not established UART communication with Wi-Fi chip.
5- After debugging, I tried to send basic AT comment to the Wi-Fi chip by using directly HAL_UART to send and receive commands. I didn't work either.
6- I got frustrated and hooked up an oscilloscope on the Wi-Fi chip's uart Tx port and got two jeberrish UART packets that does not seem to make sense. And the communication did not respond to Rx packets sent from the MCU at every 0,5 seconds.
At this point, I ran out of Idea, If you have any idea on what could be the problem or if you have suggestions I would very much appreciate it!
Thanks you for your time !
Solved! Go to Solution.
2020-11-27 08:31 AM
On the B-L4S5I-IOT01A board the STM32L4S5 and ISM433 WiFI chips are linked with SPI bus, not UART.
you can have examples of communication between the two chips with SPI by looking at STM32Cube L4 FW package in Projects/B-L4S5I-IOT01/applications/WiFi ( Common/Src/Wifi.c and es_wifi.c)
2020-11-27 07:20 AM
Dear @Aplou.1 ,
Could you please share your .ioc file.
Kind regards,
Houssem
2020-11-27 08:31 AM
On the B-L4S5I-IOT01A board the STM32L4S5 and ISM433 WiFI chips are linked with SPI bus, not UART.
you can have examples of communication between the two chips with SPI by looking at STM32Cube L4 FW package in Projects/B-L4S5I-IOT01/applications/WiFi ( Common/Src/Wifi.c and es_wifi.c)
2020-11-27 08:44 AM
If you want to do MQTT on B-L4S5I-IOT01 you could have a look at X-CUBE-CLD-GEN that uses Eclipse Paho MQTT client.
In this package the project is under Projects/B-L475E-IOT01/Applications/Cloud/GenericMQTT.
But you will have to do some adaptations because it is on B-L475E-IOT01 (precursor to B-L4S5I-IOT01), on System Workbench for STM32 IDE (precursor to STM32CubeIDE) and without OS (not on FreeRTOS).
2021-04-10 08:51 PM
Hi Guillaume!
I tested GenericMQTT example with mosquitto MQTT server with two projects examples given at en.x-cube-cld-gen\STM32CubeExpansion_Cloud_CLD_GEN_V1.0.0\Projects/B-L475E-IOT01/Applications/Cloud/GenericMQTT on B-L475E-IOT01
and at
en.x-cube-cld-gen\STM32CubeExpansion_Cloud_CLD_GEN_V1.0.0\Projects\STM32F769I-Discovery\Applications\Cloud\GenericMQTT\MDK-ARM on STM32F769I-Discovery,
wherein I observed that in both examples data is sent to MQTT mosquitto server successfully and data is received by the MQTT mosquitto server and visible in TeraTerm but the received commands are not being processed for either of the commands like
{"LedOn": true }
{"LedOn": false }
{"TelemetryInterval": <number of seconds> }
{"Reboot": true }
I observed that in GenericMQTTXcubeSample.c
at line no 266 cJSON * root = cJSON_Parse(mqtt_msg); it provides zero or NULL value in root pointer and i think due to which at line no 267
json = cJSON_GetObjectItemCaseSensitive(root, "LedOn"); it returns with NULL value and not going into belwo if statement and turning LED ON or OFF.
if (json != NULL)
{
if (cJSON_IsBool(json) == true)
{
status_data.LedOn = (cJSON_IsTrue(json) == true);
Led_SetState(status_data.LedOn);
g_statusChanged = true;
}
-- Please suggest where am I doing wrong to turn on the LED ON or OFF over MQTT- mosquitto server. if it works then I am planning to develop a Broker server based on mosquitto local host to test the complete application before switching to cloud. ( Can you also suggest such application ready for testing)
Thanks in advance .
VK Verma