I am new to the DA16200. I have the DA16200 Eval kit. Our application requires MQTT JSON packets to be published and subscribed to. I see MQTT commands under the NET commands but I do not see any documentation in the user manual for these commands. How do I set up and publish/subscribe using MQTT? is there an MQTT example code? How do I create and format a JSON packet to publish? How is the JSON packet handled on a subscribe reception?
SDK Version : V126.96.36.199 GEN
/DA16200/NET] # mqtt_config
- Usage: MQTT Configuration
mqtt_config broker <Broker IP>
mqtt_config port <Port Number> (Default: 1883)
mqtt_config pub_topic <Topic>
mqtt_config sub_topic_add <Topic>
mqtt_config sub_topic_del <Topic>
mqtt_config sub_topic <Topic Number(1~4)> <Topic#1> <Topic#2> ...
mqtt_config qos <QoS Level> (Default: 0)
mqtt_config tls <1|0> (Default: 0)
mqtt_config username <Username>
mqtt_config password <Password>
mqtt_config will_topic <Topic>
mqtt_config will_message <Message>
mqtt_config will_qos <QoS Level> (Default: 0)
mqtt_config auto <1|0> (Default: 0)
mqtt_config ping_period <period> (Default: 600)
mqtt_config ver311 <1|0> (Default: 0)
mqtt_config reset (Delete All Configuration)
mqtt_config client_id <client_id>
Hi Prem Sai,TLS certificates are stored in areas of the flash as shown in page 6, table 2 of https://www.dialog-semiconductor.com/sites/default/files/2022-05/UM-WI-048-DA16200_DA16600_FreeRTOS_OTA_Update_Rev_1v2…
The certificate authority (CA) can be used to generate a client certificate. Please refer to the link shared in my previous commenthttps://openest.io/en/services/mqtts-how-to-use-mqtt-with…
Thanks for your question and for your interest in our Low-Power Wi-Fi solutions.
Let me check this question and I'll get back to you.
I have the MQTT working with QOS=0 and QOS=1 using the public broker test.mosquitto,org and the port 1883. I am now trying to get TLS to work (port 8883) since this is a requirement. In the Dialog document um-wi-010-da16200_mqtt_programmer_user_manual_rev_1v3.pdf it shows how to load the 3 certificates and how to start the subscriber using those certificates but I am not sure where I get these certificates. I have downloaded a certificate mosquitto.org.crt from the https://test.mosquitto.org/ site. I believe that is the client certificate. where do I get the root CA and the client key? I appreciate any help you can give since this is a customer requirement that it has TLS capability.
FYI - I have escalated all your questions to our Team internally to check them out. I'll get back to you shortly.
Hi tjm ,
There is a description of MQTT in DA16200 MQTT Programmer Guide (dialog-semiconductor.com) and DA16200 AT Command (dialog-semiconductor.com).
And there is an example in samples\Network\MQTT_Client_Sample\ of SDK
There is an updated MQTT user manual.
You could test and implement MQTT refer to the above user manual.
We guide JSON sample code additionally.
DA16200 SDK supports JSON and provides sample code.
The JSON sample code is located in the below SDK directory.
Can you please let us know if you need any other clarifications?
I'm kind of in the same situation as you are.from where can we find these 3 certificates.
If you have done it please reply.
The following link explains one way to generate the certificates using OpenSSLhttps://openest.io/en/services/mqtts-how-to-use-mqtt-with-tls/ Please try this and let us know if you have any follow-up questions.
Thanks for the response.
Curretly i'm trying to test using free mqtt broker
In their website " ">www.emqx.com/.../public-mqtt5-broker" they have provided a CA.
So what i've undertsood is that this Root CA should be loaded to the DA16200 module but how can we create a client certificate as well as client private key from this Root CA.
I'm fairly new to MQTT TLS, Please correct me if i'm wrong.
The certificate authority (CA) can be used to generate a client certificate. Please refer to the link shared in my previous commenthttps://openest.io/en/services/mqtts-how-to-use-mqtt-with-tls/ The steps as described in the shared link are
1) Generating your own certificate authority (CA) using opensslopenssl req -new -x509 -days 365 -extensions v3_ca -keyout ca.key -out ca.crt2) Creating a private key and a signing request for the broker(server) openssl genrsa -out broker.key 2048openssl req -out broker.csr -key broker.key -new
3) Passing the Certificate signing request to your authority openssl x509 -req -in broker.csr -CA ../ca/ca.crt -CAkey ../ca/ca.key -CAcreateserial -out broker.crt -days 100
4) Similar to steps 2 and 3 generate a client private key, signing request and pass the request to your authorityopenssl genrsa -out client.key 2048openssl req -out client.csr -key client.key -new openssl x509 -req -in client.csr -CA ../ca/ca.crt -CAkey ../ca/ca.key -CAcreateserial -out client.crt -days 100
After these steps you can transfer the three produced files to the da16200 as described in page 24 of the
https://www.dialog-semiconductor.com/sites/default/files/2021-12/UM-WI-010_DA16200_DA16600_MQTT_Programmer_Guide_Rev_1v8.pdf Certificate authority -> ca.crtClient certificate -> client.crtClient key-> client.key
The mqtt broker configuration file will need to be updated accordingly as mentioned in the shared link
— complete mosquitto.conf: —
listener 8883cafile c:\mqtt\tls\ca\ca.crtcertfile c:\mqtt\tls\broker/broker.crtkeyfile c:\mqtt\tls\broker\broker.keyrequire_certificate trueuse_identity_as_username true
Please follow the instructions and let us know if you have follow-up questions.