<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MQTT on 54L15</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121534/mqtt-on-54l15</link><description>Hi all, 
 Has anyone implemented an MQTT client on an 54L15 before? I have been searching the web and I have not seen a sample program or anyone talking about MQTT with 54L15 only. I would appreciate any sample programs, it doesn&amp;#39;t need to be complicated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 May 2025 19:38:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121534/mqtt-on-54l15" /><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/537421?ContentTypeID=1</link><pubDate>Wed, 28 May 2025 19:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d4720dd-a9dc-4daa-8a66-88aa2105164b</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Great.&amp;nbsp;CoAP is actually the&amp;nbsp;preferred protocol as well. I will keep this case open then, please feel free to return as needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/537418?ContentTypeID=1</link><pubDate>Wed, 28 May 2025 17:32:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:886a7b3a-dd31-4e85-ab1b-3fc2a1a25e7a</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;I will try this out later, but right now we are deciding to move on to an approach of using CoAP instead. For now, thanks for your help, I may still come back to this thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/537117?ContentTypeID=1</link><pubDate>Tue, 27 May 2025 10:03:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddce7e14-cec8-4472-8dd0-b7688db650bf</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Allan,&lt;/p&gt;
&lt;p&gt;I couldn&amp;#39;t check the MQTT-SN option yet, but I reviewed the previous information and found that&amp;nbsp;CONFIG_OPENTHREAD_TCP_ENABLE wasn&amp;#39;t set in the MQTT over TCP attempts. Could you try to set that and see if MQTT works?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/536680?ContentTypeID=1</link><pubDate>Fri, 23 May 2025 02:43:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:369a2b53-0dab-4d3b-bee2-64e9906d20e9</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Due to the website outage today, I&amp;#39;m unable to provide you with my newest code at the moment. I have decided to transfer over to MQTT-SN, and it seems like all the setup functions were returning without errors, but I have never received anything from the callback function.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Regarding the debugger, I tried to follow your instructions this morning, but it was still the same issue; no matter where I set the breakpoint, it leads to the same system halt.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Essentially, my new code connects to the OTBR via thread, and waits until it is connected. After that is satisfied, I followed the steps specified at&amp;nbsp;&lt;a id="" href="https://docs.zephyrproject.org/latest/connectivity/networking/api/mqtt_sn.html"&gt;https://docs.zephyrproject.org/latest/connectivity/networking/api/mqtt_sn.html&lt;/a&gt;&amp;nbsp;to set up my device as an MQTT-SN client. However, I don&amp;#39;t really know which step I did incorrectly. I suspect it is my call to mqtt_sn_add_gw, where the third argument needed to be of type mqtt_sn_data. I created a new mqtt_sn_data struct, and set the data section to the IPv6 address of my raspi5.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;It would be great if you could give me some guidance on how to set up the MQTT-SN client following the tutorial mentioned above, thanks!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Allan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/536644?ContentTypeID=1</link><pubDate>Thu, 22 May 2025 13:46:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbef937f-63e8-44f5-a2a1-adddfcdb07e4</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hello Allan,&lt;/p&gt;
[quote user="Allan-led"]&lt;p&gt;I went further into mqtt_transport_connect and had trouble understanding how the error code was produced.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TLDR: the error code -116 was produced from mqtt_transport_connect, but I have trouble figuring out how this was produced, as the implementation for the .connect function is not visible to us.&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v4.0.99-ncs1/subsys/net/lib/mqtt/mqtt_transport.c#L61-L64"&gt;In mqtt_transport_connect(), a function pointer, which is a part of the transport_fn structure, is called&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The transport_fn structure is defined here:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v4.0.99-ncs1/subsys/net/lib/mqtt/mqtt_transport.c#L15-L22"&gt;sdk-zephyr/subsys/net/lib/mqtt/mqtt_transport.c at v4.0.99-ncs1 · nrfconnect/sdk-zephyr&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can see that the .connect field is set to this function:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v4.0.99-ncs1/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c"&gt;sdk-zephyr/subsys/net/lib/mqtt/mqtt_transport_socket_tcp.c at v4.0.99-ncs1 · nrfconnect/sdk-zephyr&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regarding the fatal error you are encountering, I agree that the&amp;nbsp;halted execution from stepping and breakpoints might have caused it. It fits the fact that it originates from MPSL, the Multi-protocol Service Layer.&lt;/p&gt;
&lt;p&gt;To overcome this, I recommend that after you reached a certain point with stepping,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set a breakpoint there&lt;/li&gt;
&lt;li&gt;Remove any prior breakpoint&lt;/li&gt;
&lt;li&gt;Reset&lt;/li&gt;
&lt;li&gt;Let the application run freely to that point&lt;/li&gt;
&lt;li&gt;Continue using either breakpoints or stepping to see where the application goes next.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/536521?ContentTypeID=1</link><pubDate>Wed, 21 May 2025 23:37:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57709850-57ac-4fe7-af45-f49b119c17d2</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Thank you for resolving my confusion about the fatal halt with reason 3, this has puzzled me for a while.&lt;/p&gt;
&lt;p&gt;In terms of the debugger, there&amp;#39;s another unexpected behavior:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747866255476v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;When my code lands at the highlighted line, it cannot go further to the breakpoint on the next line, as running it causes a system halt, which is something that I haven&amp;#39;t encountered in regular execution of the program.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I step into this line and continue stepping,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747866380660v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;I land at the memset. Trying to continue or stepping over this line will result in the system halt.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747866446411v3.png" /&gt;&lt;/p&gt;
&lt;p&gt;It still seems like reason 3 to me, but I don&amp;#39;t come across this while just executing the program.&lt;/p&gt;
&lt;p&gt;This is the same case if I try stepping in the mqtt_connect function. I think the debugger might be interfering with the mutex, which causes a system halt.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747867250514v4.png" /&gt;&lt;/p&gt;
&lt;p&gt;Since the mqtt_connect function returns -116 to me, I&amp;#39;m almost certain that the error was returned by the client_connect function. In client_connect, I added some logs, and I found that the function returns due to error_code -116 produced by mqtt_transport_connect.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747869749891v6.png" /&gt;&lt;/p&gt;
&lt;p&gt;I went further into mqtt_transport_connect and had trouble understanding how the error code was produced.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TLDR: the error code -116 was produced from mqtt_transport_connect, but I have trouble figuring out how this was produced, as the implementation for the .connect function is not visible to us.&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Allan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/536423?ContentTypeID=1</link><pubDate>Wed, 21 May 2025 11:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a76b88c-0049-4fe9-8d18-492a11bf4ced</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hello Allan,&lt;/p&gt;
&lt;p&gt;The protocol stack requires strict&amp;nbsp;interrupt and execution timing to control the radio properly, so a&amp;nbsp;debugging will cause a fault when we resume operations.&lt;/p&gt;
&lt;p&gt;What we want to do with debugging here is to use stepping or breakpoint to identify where in the call stack the error originates from. In this case, we just want to identify where in the mqtt_connect() call stack the error was initially returned.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/536282?ContentTypeID=1</link><pubDate>Tue, 20 May 2025 20:35:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2775d99-e8fb-4926-87e5-00837ad6c67a</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think the debugger has taken us very far; the error that I encountered occurred during the call to mqtt_connect(), but it did not lead to a total halt of the device. tried re-initializing the client and re-connecting it in the main while loop, and it keeps producing the same error. After the errors are produced, I am still able to interact with the device through the command line, which indicates that the device is still alive.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here are the outputs:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747771347631v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In the image above, I verified that the connection between my device and the OTBR is indeed established. I can continue interacting with the device even if the error message was produced.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then, I tried using the debugger:&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Here is where the debugger took me.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747770873952v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;However, I tried pressing continue and pausing past this point, it led me to a fatal halt with reason 3. This is actually the case with all of my projects, am I using the debugger incorrectly or is there a common issue among all of my projects?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1747771261478v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Allan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/535878?ContentTypeID=1</link><pubDate>Sun, 18 May 2025 16:14:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41890e4b-86ff-4687-ac03-37edaee81333</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Allan-led,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think anyone has tried MQTT over Thread on the nRF54L15 before, but it seems to have been &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/105692/nrf52840-mqtt-coap/455746"&gt;attempted on the nRF52840&lt;/a&gt;. The nRF54L15 has&amp;nbsp;improvements compared to the nRF52840,&amp;nbsp;so perhaps it could handle&amp;nbsp;TCP better. However, it hasn&amp;#39;t been tried, to my knowledge.&lt;/p&gt;
&lt;p&gt;As for the error you are having, it is going to be challenging to figure out from just reading the code alone.&amp;nbsp;Could you please use the debugger to get the full call stack to where it failed? That will give us more ideas to work with.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/535850?ContentTypeID=1</link><pubDate>Fri, 16 May 2025 23:24:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63ce63b5-51c0-41b7-805e-c0cf89c84dc6</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;This is the most updated version of my code. After setting client rx_buf and tx_buf, the error code became 116 instead of 12.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Running the code below would give a warning (self-defined): broker IPv6 address not in routing table. The IPv6 address that I passed in was obtained from the OTBR setup with raspi5, where the broker is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is my main.c:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/net/mqtt.h&amp;gt;
#include &amp;lt;zephyr/net/socket.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;zephyr/logging/log.h&amp;gt;
#include &amp;lt;openthread/instance.h&amp;gt;
#include &amp;lt;openthread/thread_ftd.h&amp;gt;

LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);

#define MQTT_BROKER_HOSTNAME &amp;quot;192.168.3.153&amp;quot;
#define MQTT_BROKER_PORT 1883
#define MQTT_CLIENT_ID &amp;quot;nrf54l15_subscriber&amp;quot;
#define MQTT_TOPIC_SUBSCRIBE &amp;quot;test/54L15&amp;quot;

struct mqtt_client client;
static struct sockaddr_storage broker;
otInstance *instance;

#include &amp;lt;zephyr/app_memory/app_memdomain.h&amp;gt;
K_APPMEM_PARTITION_DEFINE(app_partition);
#define APP_BMEM K_APP_BMEM(app_partition)
#define APP_DMEM K_APP_DMEM(app_partition)

#define APP_MQTT_BUFFER_SIZE 128
/* Buffers for MQTT client. */
static APP_BMEM uint8_t rx_buffer[APP_MQTT_BUFFER_SIZE];
static APP_BMEM uint8_t tx_buffer[APP_MQTT_BUFFER_SIZE];



static void broker_init(void)
{
	struct sockaddr_in6 *broker6 = (struct sockaddr_in6 *)&amp;amp;broker;

	broker6-&amp;gt;sin6_family = AF_INET6;
	broker6-&amp;gt;sin6_port = htons(MQTT_BROKER_PORT);
	inet_pton(AF_INET6, &amp;quot;fde3:8b00:6d4d:3436:0:ff:fe00:4800&amp;quot;, &amp;amp;broker6-&amp;gt;sin6_addr);
}

void mqtt_evt_handler(struct mqtt_client *const client,
                      const struct mqtt_evt *evt)
{
    switch (evt-&amp;gt;type)
    {
    case MQTT_EVT_CONNACK:
        if (evt-&amp;gt;result != 0)
        {
            printk(&amp;quot;Connection failed: %d\n&amp;quot;, evt-&amp;gt;result);
            return;
        }

        printk(&amp;quot;Connected to broker\n&amp;quot;);

        /* Subscribe to topic */
        struct mqtt_topic subscribe_topic = {
            .topic.utf8 = MQTT_TOPIC_SUBSCRIBE,
            .topic.size = strlen(MQTT_TOPIC_SUBSCRIBE)};

        const struct mqtt_subscription_list sub_list = {
            .list = &amp;amp;subscribe_topic,
            .list_count = 1,
            .message_id = 1};

        mqtt_subscribe(client, &amp;amp;sub_list);
        break;

    case MQTT_EVT_PUBLISH:
        /* Handle incoming messages */
        printk(&amp;quot;Received: %.*s\n&amp;quot;,
               evt-&amp;gt;param.publish.message.payload.len,
               evt-&amp;gt;param.publish.message.payload.data);
        break;

    case MQTT_EVT_DISCONNECT:
        printk(&amp;quot;Disconnected from broker\n&amp;quot;);
        break;

    default:
        break;
    }
}

void connect_to_broker(struct mqtt_client *client)
{
    int err;
    broker_init();
    mqtt_client_init(client);
    /* MQTT client configuration */
	client-&amp;gt;broker = &amp;amp;broker;
	client-&amp;gt;evt_cb = mqtt_evt_handler;
	client-&amp;gt;client_id.utf8 = (uint8_t *)&amp;quot;test_client&amp;quot;;
	client-&amp;gt;client_id.size = strlen(&amp;quot;test_client&amp;quot;);
	client-&amp;gt;password = NULL;
	client-&amp;gt;user_name = NULL;
	client-&amp;gt;protocol_version = MQTT_VERSION_3_1_1;

	/* MQTT buffers configuration */
	client-&amp;gt;rx_buf = rx_buffer;
	client-&amp;gt;rx_buf_size = sizeof(rx_buffer);
	client-&amp;gt;tx_buf = tx_buffer;
	client-&amp;gt;tx_buf_size = sizeof(tx_buffer);
    err = mqtt_connect(client);
    if (err != 0)
    {
        LOG_ERR(&amp;quot;Connect error: %d\n&amp;quot;, err);
    }
}

void state_changed_callback(uint32_t flags, void *context)
{
    otInstance *instance = (otInstance *)context;

    if (flags &amp;amp; OT_CHANGED_THREAD_ROLE)
    {
        switch (otThreadGetDeviceRole(instance))
        {
        case OT_DEVICE_ROLE_DISABLED:
            LOG_INF(&amp;quot;Thread role: Disabled\n&amp;quot;);
            break;
        case OT_DEVICE_ROLE_DETACHED:
            LOG_INF(&amp;quot;Thread role: Detached\n&amp;quot;);
            break;
        case OT_DEVICE_ROLE_CHILD:
            LOG_INF(&amp;quot;Thread role: Child\n&amp;quot;);
            // otThreadSetRouterEligible(instance, true);
            break;
        case OT_DEVICE_ROLE_ROUTER:
            LOG_INF(&amp;quot;Thread role: Router\n&amp;quot;);
            break;
        case OT_DEVICE_ROLE_LEADER:
            LOG_INF(&amp;quot;Thread role: Leader\n&amp;quot;);
            break;
        default:
            LOG_INF(&amp;quot;Thread role: Unknown\n&amp;quot;);
            break;
        }
    }
}

void thread_start()
{
    instance = otInstanceInitSingle();
    if (instance == NULL)
    {
        LOG_ERR(&amp;quot;Failed to initialize OpenThread instance&amp;quot;);
        return;
    }
    otError error = otSetStateChangedCallback(instance, state_changed_callback, instance);
    if (error != OT_ERROR_NONE)
    {
        printk(&amp;quot;Failed to set state changed callback: %d\n&amp;quot;, error);
        return;
    }
    otPanId panid = 0x1234;
    error = otLinkSetPanId(instance, panid);
    if (error != OT_ERROR_NONE)
    {
        printk(&amp;quot;Failed to set PAN ID: %d\n&amp;quot;, error);
        return;
    }

    error = otLinkSetChannel(instance, 24);
    if (error != OT_ERROR_NONE)
    {
        printk(&amp;quot;Failed to set channel: %d\n&amp;quot;, error);
        return;
    }
    uint8_t networkkey[] = {0x9E, 0xEA, 0xF1, 0x11, 0x19, 0xF3, 0x88, 0x74, 0x19, 0xA6, 0x22, 0x54, 0x98, 0x31, 0xD7, 0x99};
    otNetworkKey networkKey_set; // the network key to set
    memcpy(networkKey_set.m8, networkkey, sizeof(networkKey_set.m8));
    for (int i = 0; i &amp;lt; sizeof(networkKey_set.m8); i++)
    {
        printk(&amp;quot;%02X &amp;quot;, networkKey_set.m8[i]);
    }
    error = otThreadSetNetworkKey(instance, &amp;amp;networkKey_set);
    if (error != OT_ERROR_NONE)
    {
        printk(&amp;quot;Failed to set network key: %d\n&amp;quot;, error);
        return;
    }
    error = otIp6SetEnabled(instance, true);
    if (error != OT_ERROR_NONE)
    {
        printk(&amp;quot;Failed to enable IPv6: %d\n&amp;quot;, error);
        return;
    }
    error = otThreadSetEnabled(instance, true);
    if (error != OT_ERROR_NONE)
    {
        printk(&amp;quot;Failed to enable Thread: %d\n&amp;quot;, error);
        return;
    }
}

int main(void)
{
    thread_start();
    while (otThreadGetDeviceRole(instance) == OT_DEVICE_ROLE_DISABLED ||
           otThreadGetDeviceRole(instance) == OT_DEVICE_ROLE_DETACHED)
    {
        LOG_INF(&amp;quot;Waiting for device to attach to the OTBR on raspi5...&amp;quot;);
        k_sleep(K_MSEC(1000));
    }

    while (otThreadGetDeviceRole(instance) &amp;gt; OT_DEVICE_ROLE_DETACHED)
    {
        struct sockaddr_in6 *broker6 = (struct sockaddr_in6 *)&amp;amp;broker;
        char addr_str[NET_IPV6_ADDR_LEN]; // Buffer to store the IPv6 address as a string

        if (net_addr_ntop(AF_INET6, &amp;amp;broker6-&amp;gt;sin6_addr, addr_str, sizeof(addr_str)) == NULL)
        {
            LOG_ERR(&amp;quot;Failed to convert broker IPv6 address to string&amp;quot;);
        }
        else
        {
            LOG_INF(&amp;quot;Broker IPv6 address: %s&amp;quot;, addr_str);
        }

        if (net_if_ipv6_addr_lookup(&amp;amp;broker6-&amp;gt;sin6_addr, NULL) == NULL)
        {
            LOG_WRN(&amp;quot;Broker IPv6 address not in routing table&amp;quot;);
        }

        connect_to_broker(&amp;amp;client);
        k_sleep(K_SECONDS(1));
    }

    return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is my prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NETWORKING=y
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_DHCPV6=n
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_LOG=y


CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
CONFIG_NET_L2_OPENTHREAD=y
CONFIG_SETTINGS_ZMS=y
CONFIG_ZMS=y
CONFIG_NVS=n
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_SPI_NOR=n 


CONFIG_MAIN_STACK_SIZE=6144
CONFIG_SHELL_STACK_SIZE=5120

CONFIG_NET_SHELL=y
CONFIG_NET_IPV6_NBR_CACHE=y

CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=32
CONFIG_NET_BUF_TX_COUNT=32
CONFIG_HEAP_MEM_POOL_SIZE=24576&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/535836?ContentTypeID=1</link><pubDate>Fri, 16 May 2025 17:40:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6005957a-fb2a-467a-baed-60c55a3ad771</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;In addition, I have a Mosquitto broker running on my raspi5, and it has OTBR set up. I&amp;#39;m trying to connect the 54L15 via Thread.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT on 54L15</title><link>https://devzone.nordicsemi.com/thread/535671?ContentTypeID=1</link><pubDate>Thu, 15 May 2025 22:09:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39be6639-7747-4944-8859-9b7d6137d9d7</guid><dc:creator>Allan-led</dc:creator><description>&lt;p&gt;Here is the code that I have attempted to create as a simple sample program, but I receive connect error: -12.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is my main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/net/mqtt.h&amp;gt;
#include &amp;lt;zephyr/net/socket.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

#define MQTT_BROKER_HOSTNAME &amp;quot;192.168.3.153&amp;quot;
#define MQTT_BROKER_PORT 1883
#define MQTT_CLIENT_ID &amp;quot;nrf54l15_subscriber&amp;quot;
#define MQTT_TOPIC_SUBSCRIBE &amp;quot;test/54L15&amp;quot;

static struct mqtt_client client;
static struct sockaddr_storage broker;

/* MQTT event handler */
void mqtt_evt_handler(struct mqtt_client *const client,
                     const struct mqtt_evt *evt)
{
    switch (evt-&amp;gt;type) {
    case MQTT_EVT_CONNACK:
        if (evt-&amp;gt;result != 0) {
            printk(&amp;quot;Connection failed: %d\n&amp;quot;, evt-&amp;gt;result);
            return;
        }
        
        printk(&amp;quot;Connected to broker\n&amp;quot;);
        
        /* Subscribe to topic */
        struct mqtt_topic subscribe_topic = {
            .topic.utf8 = MQTT_TOPIC_SUBSCRIBE,
            .topic.size = strlen(MQTT_TOPIC_SUBSCRIBE)
        };
        
        const struct mqtt_subscription_list sub_list = {
            .list = &amp;amp;subscribe_topic,
            .list_count = 1,
            .message_id = 1
        };
        
        mqtt_subscribe(client, &amp;amp;sub_list);
        break;
        
    case MQTT_EVT_PUBLISH:
        /* Handle incoming messages */
        printk(&amp;quot;Received: %.*s\n&amp;quot;,
               evt-&amp;gt;param.publish.message.payload.len,
               evt-&amp;gt;param.publish.message.payload.data);
        break;
        
    case MQTT_EVT_DISCONNECT:
        printk(&amp;quot;Disconnected from broker\n&amp;quot;);
        break;

    default: 
        break;
    }
    
}

void connect_to_broker(void)
{
    int err;
    
    /* Initialize client */
    mqtt_client_init(&amp;amp;client);
    
    /* Set callback */
    client.evt_cb = mqtt_evt_handler;
    client.client_id.utf8 = MQTT_CLIENT_ID;
    client.client_id.size = strlen(MQTT_CLIENT_ID);
    
    /* Configure broker address */
    struct sockaddr_in *broker4 = (struct sockaddr_in *)&amp;amp;broker;
    broker4-&amp;gt;sin_family = AF_INET;
    broker4-&amp;gt;sin_port = htons(MQTT_BROKER_PORT);
    inet_pton(AF_INET, MQTT_BROKER_HOSTNAME, &amp;amp;broker4-&amp;gt;sin_addr.s_addr);
    
    /* Configure transport */
    client.transport.type = MQTT_TRANSPORT_NON_SECURE;
    client.broker = (struct sockaddr *)&amp;amp;broker;
    
    printk(&amp;quot;Client parameters: \n&amp;quot;);
        printk(&amp;quot;  Client ID: %s\n&amp;quot;, client.client_id.utf8);
        printk(&amp;quot;  Broker: %s:%d\n&amp;quot;, MQTT_BROKER_HOSTNAME, MQTT_BROKER_PORT);
        printk(&amp;quot;  Topic: %s\n&amp;quot;, MQTT_TOPIC_SUBSCRIBE);
        printk(&amp;quot;  Transport: %s\n&amp;quot;, client.transport.type == MQTT_TRANSPORT_NON_SECURE ? &amp;quot;Non-secure&amp;quot; : &amp;quot;Secure&amp;quot;);
        


    /* Connect to broker */
    err = mqtt_connect(&amp;amp;client);
    if (err != 0) {
        printk(&amp;quot;Connect error: %d\n&amp;quot;, err);
    }
}

int main(void)
{
    printk(&amp;quot;Starting MQTT subscriber\n&amp;quot;);
    connect_to_broker();
    
    while (1) {
        k_sleep(K_SECONDS(1));
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is my prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NETWORKING=y
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_IPV6=y
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_DHCPV6=n
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_LOG=y


CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
CONFIG_NET_L2_OPENTHREAD=y
CONFIG_SETTINGS_ZMS=y
CONFIG_ZMS=y
CONFIG_NVS=n
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_SPI_NOR=n 


CONFIG_MAIN_STACK_SIZE=6144
CONFIG_SHELL_STACK_SIZE=5120&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>