1

This might seem like a very broad question but that's what i want it to be for multiple ways of implementation.

I've an Arduino UNO communicating with 2 Serial devices interfaced using SoftwareSerial flawlessly. I've used [SS_Object].listen() function to switch between the two. Right now, the entire code works sequentially meaning that, once it's work with the 1st Serial device is done, only then it will switch to the 2nd Serial device and work with it. Can i communicate with the 2 in parallel (Multitasking) using FreeRtos? I've heard that the scheduler switches between tasks when it encounters a delay. So may be a small useless delay is required, only for the scheduler, to switch between the two. May be! or May be things will be better if i use more advanced Arduino like Mega or Due.

Thanks for taking your time to read this. Please answer the question the way you've understood it as i am sure different people with different experiences will interpret this differently.

Thanks in advance!

  • You really should pick a chip with multiple hardware UARTs for that. – Chris Stratton May 29 '16 at 8:10
  • Yep. that's what i thought. Thanks! @Stratton – Kushal Kumar May 29 '16 at 12:07
2

It is unlikely that FreeRTOS will allow you to do that. SoftwareSerial uses busy loops with interrupts disabled, which means it cannot be interrupted or preempted by the RTOS (or by anything for that matter).

If you want two serial connections in parallel, at least one of them should be done in hardware.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.