Skip to content

securityinmobility/marbel-mqtt-ra6m5

Repository files navigation

TLS MQTT Client for RA6M5

How to build the project correctly

Due to some needed changes in the library, some files needed to be changed. These changes are not considered by the e2studios code generation. Therefore, the following needs to be done.

  1. open e2studio
  2. create a new workspace and import the project using the "Import existing projects" option
  3. make sure e2studio is set to FSP version 4.4.0
  4. open configuration.xml and generate the code
  5. open the project folder in your file explorer e2studio/mqtt_mutual_auth_ra6m5
  6. copy the folder ra from the changed-libaries folder into the e2studio/mqtt_mutual_auth_ra6m5 folder
  7. If asked replace the files
  8. Build the project

Important! Steps 5-8 need to be done every time the code is generated.

Broker Configuration

Mosquitto running on Ubuntu 22.04 VM
Mosquitto config:

per_listener_settings true
listener 8883
allow_anonymous true
cafile ./mosquitto/ca.crt
certfile ./mosquitto/server.crt
keyfile ./mosquitto/server.key
tls_version tlsv1.2

Certificate Generation

Client Configuration

user_config.h

  • MQTT Broker Hostname (see credentials), Port and Identifier
  • MQTT Topic names
  • Credentials in PEM Format

Usage

MQTT Broker

<hostname> needs to be the same as the Common Name in the server certificate and the ip address/domain of the Broker

For example:

start broker: mosquitto -c <config file>
subscribe: mosquitto_sub -h <hostname> -t testTopic -p 8883 --cafile ./mosquitto/server.crt
publish: mosquitto_pub -h <hostname> -t instructionTopic -p 8883 --cafile ./mosquitto/server.crt -d -m "Test1"

MQTT Client (RA6M5)

Running order

  1. configures and initializes littlefs, mbedtls and provisions keys
  2. Initializes IP stack and gets IP (when using DHCP)
  3. Establishes TLS connection with multiple tries
  4. Creates MQTT Connection to Broker
  5. Subscribes to topic with multiple tries
  6. Publishes to a topic for a specified number of times and waits till it received a specified number of messages
  7. If sent and received the specified amount, disconnects the MQTT and TLS Connection and stops/deletes the task

Next Steps

  • implementing Keep Alive, Quality of Service and Last Will
  • MQTT Agent Thread
  • CAN connection

About

MQTT with mutual authentication for Renesas RA6M5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages