Closed rlevano77 closed 2 years ago
But the application fails when the mqtt clients try to connect to the mqtt broker.
Which broker? Because Mosquito will not allow external connections by default.
@carlescufi I am running mosquitto but I suspect I have wrong settings in my mosquitto.conf I will check.
In https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/net/mqtt_publisher/src/config.h#L24
define ZEPHYR_ADDR "192.168.1.101"
#define SERVER_ADDR "192.168.1.10"
If SERVER_ADDR is the IP address of the machine running the mosquitto broker? Then what ZEPHYR_ADDR is?
ZEPHYR_ADDR
is the address of the device using Zephyr, but it's not really used by the sample, must've been some leftover from the past. SERVER_ADDR
defaults to CONFIG_NET_CONFIG_PEER_IPV4_ADDR
and that config should be set to the IP address of the host running mosquitto broker.
As for the mosquitto configuration, it's well explained in https://mosquitto.org/documentation/authentication-methods/ what needs to be enabeld (in this particular case you’re interested in unauthenticated access).
Wrong mosquitto configuration and CONFIG_NET_CONFIG_PEER_IPV4_ADDR
were the issue.
mqtt_publisher
example tested with no TLS worked ok.
Thanks @rlubos , @carlescufi
mqtt_publisher does not work in atsame54_xpro board After building the example using west build -b atsame54_xpro samples/net/mqtt_publisher
The board ethernet interface link gets up and I am able to ping the board's hardcoded ip address "192.168.1.71" But the application fails when the mqtt clients try to connect to the mqtt broker.
Zephyr v.3.0 Zephyr_sdk version 0.14.1 Platform : atsame54_xpro board ( https://docs.zephyrproject.org/2.6.0/boards/arm/atsame54_xpro/doc/index.html )
Console log :