cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 LWIP MQTT & RTC

sne_123
Associate III

Hello everyone,

I am trying to use RTC in my ethernet LWIP code,but I have observed that my code hangs when I do MX_RTC_Init(); why is it so ?? Can't we use internal RTC? I can use SNTP but why does RTC hang the code??

Also my timer interrupt is not called when the device disconnects from MQTT server.. it continuosly tries to connect to MQTT server from callback. Is there any way I can handle interrupts to work properly?

4 REPLIES 4

Hello @sne_123​ ,

Could you please give us more details about the board used and the part number?

It is best to share your example for further check.

Thanks in advance.

BeST Regards,

Walid

Hey I solved the RTC issue but I am suffering in MQTT issue ..... I am using STM32F767 board

Hello @sne_123,

Great news! Could you please share what was the issue with RTC? That might be helpful for someone that would have the same issue and find this thread.

Otherwise, could you provide more information about the timer issue? Mainly what is your interrupt configuration, priorities, use case, etc... As a shot in the dark, MQTT implements a keepalive mechanism which periodically sends a ping request to the broker and expects a response. Maybe the behavior you're seeing is a side-effect of this mechanism.

BeST regards,

Walid

Hello @Walid ZRELLI​  you will laugh on my issue with RTC. It was my silly issue...Clock initialization was not done properly :D It started working after properly initializing the clock settings.

Timer issue-- I am still facing that... my ethernet priority is  HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);

and my timer priority is HAL_NVIC_SetPriority(TIM2_IRQn, 2, 1);

My problem here is timer interrupt is never called once ethernet Mqtt function goes into callback, i.e when "mqtt_connection_cb" is called... It continuously tries to connect to mqtt server never initializing the timer interrupt.