Getting error with uartStartSend function

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Getting error with uartStartSend function

Post by ep.hobbyiest »

Hi,

I am using STM32F3xx processor and chibios-uart functionality.I configure uart at 9600.

The function uartStartSend is printing for only once and after that os goes in halt state and shutdown reason is uartStartSend function only.

May be it is taking some time to send string but i gave some delay after 1st use of uartStartSend function.

But still result is same.

How to overcome this error?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Getting error with uartStartSend function

Post by Giovanni »

Hi,

Enable the debug options in chconf.h (assertions, checks, state checker), you are likely doing some detectable error. After system halts retrieve the error message using the debugger.

Debugging hints: http://www.chibios.org/dokuwiki/doku.ph ... ebug_guide

Giovanni
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Re: Getting error with uartStartSend function

Post by ep.hobbyiest »

Hi,

Here is screenshot with some extra details.

Image

and last pointing in chSysHalt function and reason is uartStartSend.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Getting error with uartStartSend function

Post by Giovanni »

Hi,

Most likely you are starting a transmission while the previous one is still in progress.

You could use uartSendTimeout() instead of uartStartSend(), the former returns when the transmission is complete.

Giovanni
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Re: Getting error with uartStartSend function

Post by ep.hobbyiest »

yeah, i tried uartSendTimeout too..

following is wrapper i m using

Code: Select all

void send_string(uint8_t *str)
{
  uint8_t size;
  size = strlen(str);
//  uartStartSend(&UARTD1, size+1, str);
  uartSendTimeout(&UARTD1, size+1, str,2000);
}



But still i got following character on terminal for send_string("Com Init-");

Code: Select all

@X@@l@ @▒@@
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Getting error with uartStartSend function

Post by Giovanni »

Speed problem, make sure to use 38400-8-N-1.

Giovanni
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Re: Getting error with uartStartSend function

Post by ep.hobbyiest »

I am using 19200 baud rate and uart it throughing data now. but driver is not considering size i m giving.

it continously printing some statements.

i am prinitng "sysInit" and i got following as output.

sysInit-chSysUnlock@.

i am apending '\0' also and giving size also.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Getting error with uartStartSend function

Post by Giovanni »

Question, why are you using the UART driver and not the Serial driver? the serial driver is more suited for printing text and easier to use.

Both drivers use 38400 as default speed, if you want to use a different speed then you need to configure them properly.

Giovanni
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Re: Getting error with uartStartSend function

Post by ep.hobbyiest »

i am bit confused here.
is there any different api's for Serial driver. If yes, please tell me the filename.

I want to print text only.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Getting error with uartStartSend function

Post by Giovanni »

The serial driver is used in most demos, you can use chprintf() to print text. See the channels section in the manual for the API.

Giovanni
Post Reply