MQTT publisher working on NRF52833 but not NRF52840

Hello I have a project where I want to send sensor data through mqtt. I have built and tested the project based on the mqtt publisher sample by using the NRF52833 device tree on  NRF52840 chip on nrf sdk 1.9.1.

however everything was working fine for me I noticed at a late stage that I was using the wrong device tree. when I migrated the code to NRF52840 device tree the MQTT kept giving me the error trying to connect -116.  however weirdly it would work fine sometimes then it will go back to trying to connect error. 

I have identical overlays on both the nrf52833 and nrf52840 and I also tried disabling all other unused peripherals.

Here is my configurations 




#


# fs_dirent structures are big.
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_INIT_STACKS=y
# Disable unneeded mbedtls modules
CONFIG_SPI=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_ETH_W5500=y
CONFIG_ETH_W5500_TIMEOUT=1000
CONFIG_NEWLIB_LIBC=y
# CONFIG_PWM=y
CONFIG_NETWORKING=y
CONFIG_NET_IPV6=n
CONFIG_NET_IPV4=y

CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y

CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y

CONFIG_NET_STATISTICS=y

CONFIG_NET_LOG=y
CONFIG_LOG=y

CONFIG_SLIP_STATISTICS=n

CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_BUF_DATA_SIZE=256
# CONFIG_SERIAL=n

CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
# CONFIG_ADC=y
CONFIG_GPIO=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_PM_SINGLE_IMAGE=y

# Need float format support
CONFIG_NEWLIB_LIBC_NANO=y=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
# CONFIG_CBPRINTF_FP_SUPPORT=y

# CONFIG_LOG=y

# Enable the MQTT Lib
CONFIG_MQTT_LIB=y
# CONFIG_MQTT_LOG_LEVEL_DBG=y

#UART
# CONFIG_SERIAL=y
# CONFIG_UART_INTERRUPT_DRIVEN=y

# #RTT seiral
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y




and here is the overlay:

 &spi2 {
	compatible = "nordic,nrf-spi";
	status = "okay";
	sck-pin = <17>;
	mosi-pin = <22>;
	miso-pin = <32>;
	cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
	test_spi_w5500: w5500@0 {
		compatible = "wiznet,w5500";
		label = "w5500";
		reg = <0x0>;
		spi-max-frequency = <1000000>;
		int-gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
		reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
	};
};

Error code 

[00:00:20.260,986] <inf> net_dhcpv4_client_sample: attempting to connect: 
[00:00:23.264,617] <inf> net_dhcpv4_client_sample: mqtt_connect: -116 <ERROR>
[00:00:23.664,733] <inf> net_dhcpv4_client_sample: try_to_connect: -22 <ERROR>
[00:00:33.664,916] <inf> net_dhcpv4_client_sample: attempting to connect: 
[00:00:36.678,222] <inf> net_dhcpv4_client_sample: mqtt_connect: -116 <ERROR>
[00:00:37.078,338] <inf> net_dhcpv4_client_sample: try_to_connect: -22 <ERROR>

Related