Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mqtt_publisher does not work in atsame54_xpro board #45664

Closed
rlevano77 opened this issue May 15, 2022 · 4 comments
Closed

mqtt_publisher does not work in atsame54_xpro board #45664

rlevano77 opened this issue May 15, 2022 · 4 comments
Assignees
Labels
area: Networking Clients bug The issue is a bug, or the PR is fixing a bug platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) priority: low Low impact/importance bug

Comments

@rlevano77
Copy link

rlevano77 commented May 15, 2022

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 :

uart:~$ *** Booting Zephyr OS build zephyr-v3.0.0-3319-g8566b00df3e1  ***
[00:00:00.255,000] <err> mdio_sam: transfer timedout MDIO
[00:00:00.510,000] <err> mdio_sam: transfer timedout MDIO
[00:00:00.765,000] <err> mdio_sam: transfer timedout MDIO
[00:00:01.020,000] <err> mdio_sam: transfer timedout MDIO
[00:00:01.020,000] <inf> eth_sam: MAC: 02:04:25:4c:b8:00
[00:00:01.020,000] <inf> eth_sam: Queue 0 activated
[00:00:01.026,000] <inf> net_config: Initializing network
[00:00:01.026,000] <inf> net_config: Waiting interface 1 (0x20000388) to be up...
[00:00:05.059,000] <inf> phy_mii: PHY (0) Link speed 100 Mb, full duplex
[00:00:05.059,000] <inf> eth_sam: Link up
[00:00:05.059,000] <inf> net_config: Interface 1 (0x20000388) coming up
[00:00:05.060,000] <inf> net_config: IPv4 address: 192.168.1.71
[00:00:05.060,000] <inf> net_mqtt_publisher_sample: attempting to connect:
[00:00:08.060,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:11.561,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:15.061,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:18.562,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:22.062,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:25.563,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:29.063,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:32.564,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:36.064,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:39.565,000] <inf> net_mqtt_publisher_sample: mqtt_connect: -116 <ERROR>
[00:00:40.065,000] <inf> net_mqtt_publisher_sample: try_to_connect: -22 <ERROR>
[00:00:45.065,000] <inf> net_mqtt_publisher_sample: attempting to connect:
uart:~$ uart:~$ *** Booting Zephyr OS build zephyr-v3.0.0-3319-g8566b00df3e1  **

@rlevano77 rlevano77 added the bug The issue is a bug, or the PR is fixing a bug label May 15, 2022
@henrikbrixandersen henrikbrixandersen added area: Networking Clients platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) labels May 17, 2022
@carlescufi carlescufi added the priority: low Low impact/importance bug label May 17, 2022
@carlescufi
Copy link
Member

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.

@rlevano77
Copy link
Author

@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?

@rlubos
Copy link
Contributor

rlubos commented May 23, 2022

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).

@rlevano77
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Clients bug The issue is a bug, or the PR is fixing a bug platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants