I’m running the MQTT Agent demo application on my board and after a long period of successful MQTT publishing I suddenly see a call to vApplicationIPNetworkEventHook(true) that cause the application to run on top of the previous invocation and from here I get hard fault.
The DHCP server should provide a lease time, after which the DHCP process repeats. Normally the DHCP server will give the same address again. Could that be what you are seeing here? Do you know the lease time - you will be able to view it if you look at the DHCP packets in Wireshark (or just see it in the code https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/FreeRTOS_DHCP.c#L996 ).
OK, I checked this and it is half an hour and indeed it might be the cause for the event I see but should this cause the application to rerun on itself?
The vApplicationIPNetworkEventHook is being trigged by this event and I assume the eNetworkEvent is true as otherwise the function would have been return with no action, and since it is passed that if( eNetworkEvent == eNetworkUp ) it call again to the vStartSimpleMQTTDemo, isn’t it?
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
{
/* If the network has just come up…*/
if( eNetworkEvent == eNetworkUp )
{
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
char cBuffer[ 16 ];