Good day,
I have code running on Core 0 and different code on Core 1.
I would like to serial.print stuff from both cores, but let's say core1 has to finish writing before core 0 can use the serial hardware.
IE i want to queue core 0's message to wait for the buffer to be empty before attempting to send, thereafter core 0 has access once again.
Core 1 will send tons of messages really fast and Core 0 only now and then, it is very important that they share the hardware serial I do not want to use one of the other serial ports available.
If anyone can point me to a way of checking if the serial transmit buffer is empty that would be great.
Regards
Lodewyk
Dual Core share serial
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Dual Core share serial
You should set a binary semaphore, and have each processes take the semaphore when they need to write. Then, simply flush the serial object, write, and give back the semaphore. Rinse, repeat.
https://docs.espressif.com/projects/esp ... aphore-api
https://docs.espressif.com/projects/esp ... aphore-api
Who is online
Users browsing this forum: Majestic-12 [Bot] and 100 guests