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
Flickering 7 segment LEDs using core 0 for scanning
-
- Posts: 9729
- Joined: Thu Nov 26, 2015 4:08 am
Re: Flickering 7 segment LEDs using core 0 for scanning
Look at the priorities of your tasks. You probably want the task that does your LEDs to have a high priority. You can also use the I2S peripheral in parallel ('LCD') mode to more-or-less automatically scan your LEDs without using any CPU time.
Re: Flickering 7 segment LEDs using core 0 for scanning
Changed priority on core 0 from 1 to 0. Flickering remains, perhaps a little worse. Not sure how to do I2S peripheral in parallel ('LCD') mode to more-or-less automatically scan your LEDs without using any CPU time. Can you point me to an explanation. Attached the schematic of my circuit so you can see how I scan.
Thanks, Theron
Thanks, Theron
- Attachments
-
- Figure 1.jpg (633.26 KiB) Viewed 5305 times
Re: Flickering 7 segment LEDs using core 0 for scanning
Would you be able to use 2 of these side to side? If so, it would eliminate your timing issues. just use I2C to drive them.
https://www.adafruit.com/product/3107
https://www.adafruit.com/product/3107
-
- Posts: 9729
- Joined: Thu Nov 26, 2015 4:08 am
Re: Flickering 7 segment LEDs using core 0 for scanning
Changing the tasks priority from 1 to 0 won't do much, as the tasks get more priority with a *higher* priority number.
Who is online
Users browsing this forum: No registered users and 85 guests