Hello!
I have a problem with MQTT Publisher example on my nrf52840 DK.
here is my steps:
1. I edit nrf52840 mqtt example code with
#define APP_MQTT_BROKER_PORT 1883
Edit my MQTT settings with:
memcpy(m_app_mqtt_client.broker_addr.u8, m_broker_addr.u8, IPV6_ADDR_SIZE); m_app_mqtt_client.broker_port = APP_MQTT_BROKER_PORT; m_app_mqtt_client.evt_cb = app_mqtt_evt_handler; m_app_mqtt_client.client_id.p_utf_str = (uint8_t *)m_client_id; m_app_mqtt_client.client_id.utf_strlen = strlen(m_client_id); m_app_mqtt_client.p_password = NULL; //(mqtt_password_t*)"lzbHSKesAlEi"; m_app_mqtt_client.p_user_name = NULL; //(mqtt_username_t*)"ioibvutn"; m_app_mqtt_client.transport_type = MQTT_TRANSPORT_NON_SECURE; m_app_mqtt_client.p_security_settings = NULL; //&m_tls_keys;
I made nrf52860's ipv6 address (FE80::25E:0DFF:FEAE:183E) with global prefix from MAC:
static const ipv6_addr_t m_broker_addr = { .u8 = {0x20, 0x01, 0x0D, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x5E, 0x0D, 0xFF, 0xFE, 0xAE, 0x18, 0x3E} };
2. Download firmware
3. Install mosquitto on my Raspberry Pi 3 and leave it with default configurations without certs. Here is conf file:
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
pid_file /var/run/mosquitto.pid
# cafile /etc/mosquitto/certs/cert.crt
# certfile /etc/mosquitto/certs/cert.crt
# keyfile /etc/mosquitto/certs/newca.pem
# cafile /path/to/rootCA.pem
# certfile /path/to/server.crt
# keyfile /path/to/server.key
# require_certificate false
# tls_version tlsv1
4.Set a global IPv6 prefix as in this link
5. Strt mosquitto with console command "mosquitto -p 1883" and get back some lines (there my smartphone was connected to broker):
6. i enabled 6lowpan:
modprobe bluetooth_6lowpan
echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
7. Connect to my nrf52840:
echo "connect 00:5E:0D:AE:18:3E 1" > /sys/kernel/debug/bluetooth/6lowpan_control
8. Add global prefix to BT0:
ifconfig bt0 add 2001:db8::1/64
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
service radvd restart
9. And try to ping nrf52840:
ping6 -I bt0 2001:DB8::25E:0DFF:FEAE:183E
And its pinging ok!
10. Then i started tshark:
tshark -i bt0 -Y "tcp.port==1883"
and try to monitor whats going on
After i pressed the connect button and get tshark log
Also i connect terminal to watch APP output log after the ipv6 link was established:
I always cant connect to broker. What is wrong with it?