The application has a few other FreeRTOS tasks, and when running everything without internet connection it works just fine.
However, I need to periodically send some data through MQTT, and for that, I'm using a modified version of the provided MQTT via TCP example.
The problem is that when I add this networking task, the PWM signal gets messed up. However, I don't understand why, as it is produced with a hardware timer and interrupts. It seems like the network task is either
a) disabling all interrupts when it runs
b) generating very long interrupts delaying the execution of timer interrupts
c) The networking task is using the timer internally, which doesn't seem the case, as I have read that only TIMER_GROUP_1 is used by internal components
I can provide some code if you think it might help to solve the issue.
Some details:
The used timer is TIMER_1 from TIMER_GROUP_0
The MQTT task has a period of 1 second, and it seems like only when it runs the PWM signal gets messed up
Things I've tried so far:
- Changing all the FreeRTOS tasks to run on core 0, then setting TCP/IP core affinity to core 1
Changing the hardware timer used to generate the PWM signal
Changing the timer interrupt priority to level 3 (the highest callable from a C context)
Reducing the MQTT task period