This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT_ERR_TCP_PROC_FAILED error

Dear Team

I use the Lwip_mqtt_publisher example from the SDK 15.3 with a PCA10056 board.

Also, I used an Ubuntu 18 Instance(IPv4, I used 6tunnel) to run the Mosquitto Broker with the 1883 port; I used a mobile MQTT app to test the broker and it worked.

I changed the example as

static void app_mqtt_connect(void)
{
    mqtt_client_init(&m_app_mqtt_client);

    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; // 1883
    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;
    m_app_mqtt_client.p_user_name          = NULL;
    m_app_mqtt_client.transport_type       = MQTT_TRANSPORT_NON_SECURE /*MQTT_TRANSPORT_NON_SECURE*/;
    m_app_mqtt_client.p_security_settings  = NULL/*&m_tls_keys*/;

    uint32_t err_code = mqtt_connect(&m_app_mqtt_client);
    APP_ERROR_CHECK(err_code);
    // mqtt_connect returns MQTT_ERR_TCP_PROC_FAILED
}

After following the configurations from the Info Center, I typed these on my Raspberry Pi 3 (Raspbian Stretch) to connect

root@raspberrypi:/home/pi# cat /etc/radvd.conf
interface bt0
{
    AdvSendAdvert on;
    prefix 2001:db8::/64
    {
        AdvOnLink off;
        AdvAutonomous on;
        AdvRouterAddr on;
    };
};
root@raspberrypi:/home/pi# ps aux | grep 6tunnel
pi        1075  0.0  0.0   2248   136 ?        Ss   15:37   0:00 6tunnel -6 1883 182.22.25.124 1883
root      4575  0.0  0.0   4372   552 pts/0    S+   17:53   0:00 grep 6tunnel
root@raspberrypi:/home/pi# modprobe bluetooth_6lowpan
root@raspberrypi:/home/pi# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
root@raspberrypi:/home/pi# hciconfig
hci0:	Type: Primary  Bus: UART
	BD Address: B8:27:EB:45:8E:3C  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:37000 acl:1226 sco:0 events:1368 errors:0
	TX bytes:74068 acl:1401 sco:0 commands:501 errors:0

root@raspberrypi:/home/pi# hciconfig hci0 reset
root@raspberrypi:/home/pi# echo "connect 00:1E:CF:F0:BB:AA 1" > /sys/kernel/debug/bluetooth/6lowpan_control
root@raspberrypi:/home/pi# echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
root@raspberrypi:/home/pi# ifconfig bt0 add 2001:db8::1/64

root@raspberrypi:/home/pi# ifconfig
bt0: flags=4161<UP,RUNNING,MULTICAST>  mtu 1280
        inet6 fe80::b827:ebff:fe45:8e3c  prefixlen 64  scopeid 0x20<link>
        inet6 2001:db8::1  prefixlen 64  scopeid 0x0<global>
        unspec B8-27-EB-45-8E-3C-30-57-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 1  bytes 28 (28.0 B)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 18  bytes 1837 (1.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.11  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::5abd:7250:be51:d54d  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:ef:24:96  txqueuelen 1000  (Ethernet)
        RX packets 38972  bytes 3223646 (3.0 MiB)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 48500  bytes 38697797 (36.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 30  bytes 3948 (3.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 3948 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:ba:71:c3  txqueuelen 1000  (Ethernet)
        RX packets 31  bytes 4459 (4.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 76  bytes 13778 (13.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@raspberrypi:/home/pi# service radvd restart
root@raspberrypping6 -c 6  2001:db8::21E:CFFF:FEF0:BBAA
PING 2001:db8::219:CFFF:FEF0:B94A(2001:db8::219:cfff:fef0:b94a) 56 data bytes
From 2001:db8::1 icmp_seq=1 Destination unreachable: Address unreachable
From 2001:db8::1 icmp_seq=2 Destination unreachable: Address unreachable
From 2001:db8::1 icmp_seq=3 Destination unreachable: Address unreachable
From 2001:db8::1 icmp_seq=4 Destination unreachable: Address unreachable
From 2001:db8::1 icmp_seq=5 Destination unreachable: Address unreachable
From 2001:db8::1 icmp_seq=6 Destination unreachable: Address unreachable

--- 2001:db8::21E:CFFF:FEF0:BBAA ping statistics ---
6 packets transmitted, 0 received, +6 errors, 100% packet loss, time 5185ms

root@raspberrypi:/home/pi# 

this is what I got. The numbers, 00:1E:CF:F0:BB:AA, broker's IP 182.22.25.124 are example numbers.

After typing ECHO CONNECT, I noticed the LED1 - LED2 - LED1 change.

I think I have configured most of it. However, I get MQTT_ERR_TCP_PROC_FAILED when I press Button 1. Can I ask what is wrong?

Parents Reply Children
  • "Enable legacy mode of IID derivation from Bluetooth Device Address and Link Layer address size determination. The legacy mode is not compatible with the RFC7668 sepcification. For the Linux Kernel versions higher or equal to 4.12 this define has to be set to 0, otherwise to 1."

    Thanks for pointing that out. The MQTT mobile app which subscribed to the "led/state" topic successfully receives the states.

    One thing before closing this; I've set the BLE_6LOWPAN_LEGACY_MODE to 0 now.

    I pressed Button 1 and observe that the Mosquitto broker reports a new connection from the client "nrfPublisher".
    I also observed that LED 2 is lit, which means that the connection is established.

    - When pressing Button 2, sometimes the LED 3 flashes.

    From the infocenter, it says that this means "Flashes once, if publishing of the LED state failed."

    - Regardless of whether I press Button 2 or not after pressing Button 1, the connection between the PCA10056 and the RPi 3 becomes disconnected. So the PCA10056 starts to blink LED 1 again.

    This happens after 10 seconds when I press Button 1.

    However, this doesn't seem to be a reset. When the LED 1 blink again, LED 3 and 4 remains on.

    Is this a connection issue between the PCA10056 and the RPi?

    I placed together right next to each other, a distance less than 100mm.

  • Hi,

     

    Button 2 (indexing from 0 and up) is for disconnecting the link. If the device has not been able to successfully send the first publish, and you press button 2 quickly afterwards, it is likely disconnecting before it can properly publish. If you check the log output it could probably give you more details on what's happening.

     

    Kind regards,

    Håkon 

Related