cancel
Showing results for 
Search instead for 
Did you mean: 

SPC560D UART

Patriks
Senior
Posted on October 16, 2014 at 12:24

Hello,

I have some problems understanding and using the UART HAL component.

 

The test application for the SPC560D sends ''Hello World'' with the chnWriteTimout() function. To send the value 0x55, I wrote

chnWriteTimeout(&SD1, (uint8_t *)

0x55

, 2, TIME_INFINITE);

But this did not work. I doesn´t matter which value I tried to send, I am always receiving a different value. Only when I am sending characters, the received data equals the sended data. What is wrong with my command?

My second question is: is it possible to write my own UART driver? The driver from the library is too complex for my application. I just want to periodically send data triggered by a timer interrupt and to work with the UART interrupt if I receive data.

Therefore, I started to write my own driver. So I deactivated SERIAL in the configuration, but I am not able to configure LinFlex. Setting LinFlex to initialization mode by setting  

LINFLEX_0.

LINCR1

.

B

.

INIT

= 1;

did not work. What would be the correct steps to be able to configure the LinFlex component?

Best regards,

Patrik
1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee
Posted on November 14, 2014 at 15:50 Hello Patrik, No problem has been noticed chnWriteTimeout is waiting for a pointer on the data to send. if you want to send a Hexadecimal, use a pointer. (cf code below)

const

uint8_t constHexToSend = 0x55;
chnWriteTimeout(&SD1, (uint8_t *)&constHexToSend, 1, TIME_INFINITE);

Best regards Erwan

View solution in original post

4 REPLIES 4
Patriks
Senior
Posted on October 23, 2014 at 11:20

Hello,

Finally, I was able to understand how I can adapt the UART component to send the commands I needed.

Currently, I am using two interfaces: UART and SPI. The SPI communication runs periodically every 1ms. When I additionally send some commands over UART, the program always jumps to the adress 0x000000E0 after a view milliseconds and hangs there. Looking in the out.map file, i found at this memory entry several _IVOR entries.

Does anybody now what the reason for the jump to this adress could be and how I can avoid that?

Best regards,

Patrik

Patriks
Senior
Posted on October 23, 2014 at 16:19

Hello,

I just found out, that the controller (SPC560B) shows the same behaviour when I use only UART in software. I sent continously data with hyperterminal to the controller and I got the same error. As software project, I used the discovery board demo for SPC560B and adapted it for UART receive. Is this probably an error in the ST serial driver?

Erwan YVIN
ST Employee
Posted on November 14, 2014 at 14:29

Hello Patrik ,

it is important to put the exact size of your local array in this following function :

chnWriteTimeout(&SD1, (uint8_t *) 0x55, 1, TIME_INFINITE);

Do you reproduce the similar issue with the application :

ChibiOS-RT SPC560Dxx Test Application for Discovery or ChibiOS-RT SPC560Bxx Test Application for Discovery ? anyway , we will check this issue. Best Regards Erwan
Erwan YVIN
ST Employee
Posted on November 14, 2014 at 15:50 Hello Patrik, No problem has been noticed chnWriteTimeout is waiting for a pointer on the data to send. if you want to send a Hexadecimal, use a pointer. (cf code below)

const

uint8_t constHexToSend = 0x55;
chnWriteTimeout(&SD1, (uint8_t *)&constHexToSend, 1, TIME_INFINITE);

Best regards Erwan