cancel
Showing results for 
Search instead for 
Did you mean: 

X-CUBE-CELLULAR 5.2.x MQTT Client Sample, does not work when using STM32CubeIDE based on GCC.

PGell.1
Associate II

Instead, the project under IDE_Mqtt folder of X-CUBE-CELLULAR 5.2.x work fine, because it uses IAR Compiler and Embedded Workbench IDE (downloaded under 30day evaluation).

The sample code provided, I was able to test it using Stackhero Node-RED Dashboard, very useful to have a quick demo out-of-the-box.

But I've spent some days to investigate w/o success the reason why using GCC compiler (after adding MQTT/MBedTLS libs files and #defines, on duplicating an existing STM32CUbeIDE project) this demo crash with an HardFault when executing the code in the snippets and called by mqtt_connect(). - Tested with ST-LINK and Debug code prj.

struct mqtt_queued_message* mqtt_mq_register(struct mqtt_message_queue *mq, size_t nbytes)
{
    /* make queued message header */
    --(mq->queue_tail);
    mq->queue_tail->start = mq->curr;
    mq->queue_tail->size = nbytes;
    mq->queue_tail->state = MQTT_QUEUED_UNSENT;
 
    /* move curr and recalculate curr_sz */
    mq->curr += nbytes;
    mq->curr_sz = mqtt_mq_currsz(mq);
 
    return mq->queue_tail;
}

So Cellular connection is established, context CID=1 up and running, with DNS server name resolved, so the modem is not failing. MQTT socket also is connected with the remote server, but packing the data to transfer leads to the issue.

Please STM could have a look, or already have an answer as maybe this was the reason to not include such MQTT project for STM32CUbeIDE in the X-CUBE-CELLUALR 5.2.0 release?

TYIA

Paolo

s

4 REPLIES 4
Amr Elsayed
Associate II

Hi, I have the same problem as yours. have you managed a fix ?

Can anyone from ST confirm the bug ?

PGell.1
Associate II

I presume ST no longer wants to support this kind of demo, since release 6.0.x

Amr Elsayed
Associate II

yes I agree, I managed to use v6.0 with TCP stack over LWIP instead of Modem. and then used the MQTT application of the LWIP.

Hey Amr, I'm a bit late in trying out X cube cellular. Just wondering how you managed to implement this? I see some MQTT files in the Middlewares/Third_Party/LwIP/test/unit folder but I'm not sure how this to configure this in the source code? :')