Flickering 7 segment LEDs using core 0 for scanning
Posted: Fri Mar 08, 2019 1:50 pm
I have a working digital clock program using 7 segment LEDs.
Both cores are used, core 0, set at priority 1, simply scans the LEDs by using 8 GPIO pins to set the 7 segments and then enabling that digit.
Core 1 does everything else.
1. Checks if WiFI is still connected.
2. Checks the RTC to see if a second has passed and then updates the time settings.
3. Reads time and date from Internet (from NTP server).
4. Reads local temperature and humidity from BME280.
5. Reads weather information from Internet.
6. Displays weather information on 4 line LCD.
Everything works except I get ghost segments flickering on randomly, as well as some full digit flicker. In addition I get task watchdog triggered every few seconds, although this does not seem to effect anything. Tight loop in core 0 probably is setting this off, but I need speed there as 8 digits need to be scanned at least every 30 milliseconds.
I suspect the tight loop in core 0 gets interrupted by the wireless radio, which I understand runs on core 0, and this is causing the flickering.
If I swap the tasks, core 0 doing what core 1 did, etc., I have problems with the LCD display. RTC and BME280 run on I2C as well as the LCD. Running these on core 0 causes LCD to malfunction.
Any suggestions?
Thank you,
Theron Wierenga
Both cores are used, core 0, set at priority 1, simply scans the LEDs by using 8 GPIO pins to set the 7 segments and then enabling that digit.
Core 1 does everything else.
1. Checks if WiFI is still connected.
2. Checks the RTC to see if a second has passed and then updates the time settings.
3. Reads time and date from Internet (from NTP server).
4. Reads local temperature and humidity from BME280.
5. Reads weather information from Internet.
6. Displays weather information on 4 line LCD.
Everything works except I get ghost segments flickering on randomly, as well as some full digit flicker. In addition I get task watchdog triggered every few seconds, although this does not seem to effect anything. Tight loop in core 0 probably is setting this off, but I need speed there as 8 digits need to be scanned at least every 30 milliseconds.
I suspect the tight loop in core 0 gets interrupted by the wireless radio, which I understand runs on core 0, and this is causing the flickering.
If I swap the tasks, core 0 doing what core 1 did, etc., I have problems with the LCD display. RTC and BME280 run on I2C as well as the LCD. Running these on core 0 causes LCD to malfunction.
Any suggestions?
Thank you,
Theron Wierenga