Basic Question relating to the serial driver

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
hansen
Posts: 1
Joined: Sun Oct 21, 2012 9:32 pm

Basic Question relating to the serial driver

Post by hansen »

Hello,

I want to use the serial driver to echo back what is received from the serial port back by using , I intend to write parsing routines eventually

Below is a fragment of my code in a thread

while (TRUE) {

chr=chIOGet(chp);

if (chr >0 && chr<128) //check if character is valid ascii
chIOPut(chp,chr);

chr=0;
}

I am getting characters echoed back to the serial port using the code above at a very slow rate and sometimes garbage chars.
What is the correct approach to reading characters from the serial port and eventually parsing it

Thanks,
Hansen
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Basic Question relating to the serial driver

Post by Giovanni »

Hi,

Is the thread doing this loop at equal or lower priority of some other thread that could delay it?

Giovanni
Post Reply