cancel
Showing results for 
Search instead for 
Did you mean: 

SPC560D30L3 - Serial driver configuration

ssk
Associate II
Posted on June 04, 2015 at 16:52

I am using SPC560D30L3 with 8MHz crystal. The initialisation settings are as below,

1. IDF = 1

2. NDIV = 48

3. ODF = ODF_DIV8

I have configured the serial for 38400 baud with buffer for 16 bytes. I am trying to send a frame of 7 bytes from PC (using hyperterminal or similar terminal utility). What I have observed is I am receiving only 2 bytes out of 7 - the first and last, in between bytes are lost. What is the problem? Are any setting missing?

The two bytes received are correct, hence I have little doubt for baud setting. Am I correct? I tried different baud settings but same observations. What could be the problem?

Is there any difference in configuration by selecting the Configuration->Identification->Board Identifier and Board Name as 'SPC56D_DISCOVERY' and 'STMicroelectronics SPC56D Discovery' as against the value 'generic SPC56D board'? I have observed that default clock settings differ between the two settings. First one gives XOSC clock as 16MHz and generic gives as 8MHz. Are there any configuration changes? Why these are so?

Your earliest help in this regard will be highly appreciated. Thanks in advance.

Mike.

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
11 REPLIES 11
ssk
Associate II
Posted on June 09, 2015 at 10:20

Referring to below post, I have observed that if I put a delay of 100mS (using function 'osalThreadSleepMilliseconds(100)' - not sure if it is true 100mS), the code functions correctly. Is there any relation of this function for overall code execution or is it required for SPC5Studio?

I have observed calls to this function in every test application provided. Any specific reason / relation for using this function?

Your quickest help in this regard will be highly appreciated. Thanks.

Mike.

Erwan YVIN
ST Employee
Posted on June 10, 2015 at 15:23

Hello Mike ,

Could you send me your application or code example ? which API do you use to get the byte from the terminal ? did you use

chnReadTimeout(&SD1, &car, 1, TIME_INFINITE);

? All the D Family are delivered in the mode ''STMicroelectronics SPC56D Discovery'' the default configuration for a discovery board is 16MHz (DISCOVERY) The Mini Module + D Family are not provided for the Mass Market. The default configuration for a Generic One is 8MHz (GENERIC) Best regards Erwan
ssk
Associate II
Posted on June 15, 2015 at 14:38

I am using following API for reading the characters,

chnReadTimeout(pSD, pCommand->u8Data, pCommand->u8Length, TIME_IMMEDIATE);

What is 'Mini Module + D family'? You mean all variants from D family.

Thanks.

Mike.

Erwan YVIN
ST Employee
Posted on June 15, 2015 at 16:31

Hello Mike ,

Minimodule (D Family) is not provided in ST Web site

it is a motherboard + a Minimodule + the device (D in this case).

not the same price comparing to a discovery board.

the default configuration for a discovery board is 16MHz (DISCOVERY)

About your issue , maybe the best thing is to scan the character char by char

chnReadTimeout(&SD1, &car, 1, TIME_INFINITE);

Could you give me an example of your application ?

We will try to find the root cause.

   Best Regards

               Erwan

ssk
Associate II
Posted on June 16, 2015 at 10:28

Hello Erwan,

Regarding the API call, I see only two options for 'time' parameter - 

TIME_INFINITE and 

TIME_IMMEDIATE.

 Can I use custom value here? If yes how to use it?

If I use 

TIME_INFINITE

, will it wait forever till a character is received? I want to use a timeout value instead of waiting for character all the time. Please guide me how to implement this.

Thanks.

Mike.

ssk
Associate II
Posted on June 16, 2015 at 17:24

1. I tried using '

TIME_INFINITE'

 and it looks to be working but will it pose any risk in case the incoming frame gets broken in between as I am reading more than one character once I receive SOF (start of frame) byte?

2. I observed that with '

TIME_INFINITE'

, my code gets stuck after 3-4 frame reception, what is the cause? How can I flush the Rx and Tx buffers for fresh reception and transmission?

3. Any means to use a timeout value instead of '

TIME_INFINITE'?

Thanks in advance for help.

Mike.

Erwan YVIN
ST Employee
Posted on June 17, 2015 at 11:02

Hello Mike ,

1- The function reads data from a channel into a buffer. If the data is not available then the calling thread is suspended. 

For the option TIME_INFINITE , you need to create a way to detect a broken frame.

2- Is it a Data Abort ? 

Did you try sdp->linflexp->UARTSR.R = SPC5_UARTSR_RMB  ?

 

Have you got an example of your application ?

3- Time is the number of ticks before the timeout

 * @param[in] time      the number of ticks before the operation timeouts,

 *                      the following special values are allowed:

 *                      - @a TIME_IMMEDIATE immediate timeout.

 *                      - @a TIME_INFINITE no timeout.

Best Regards

                                Erwan

ssk
Associate II
Posted on June 18, 2015 at 16:35

Hello Erwan,

1. The SPC5_UARTSR_RMB looks to be working correct. It is getting set along with DRF but the frame is not received. What could be the reason?

2. I tried using read API for single byte as well, only thing when I receive SOF, I used a for loop for no of bytes to read (here 7 bytes), each time reading single byte. But this also shows same behaviour.

3. I tried reducing the delay from 100 to 25 (baud is 38400). It looks that with delay in main loop, it works but when I simply remove the delay I receive complete frame but with wrong values. Is it related to high baud rate value?

4. You said only two values allowed for 'time' parameter for API. How about using a custom value of known time?

Thanks for your help.

Mike.

ssk
Associate II
Posted on June 23, 2015 at 10:48

Hello,

I am waiting for replies to above queries. Please respond.

I am seeing following errors for few library files from SPC5Studio. Whether above observations for serial communication is because of these errors?

Symbol 'bool' could not be resolved          serial.c  /ECU/components/portable_spc5_hal_component/lib/src   line 204            Semantic Error

Symbol 'NULL' could not be resolved        serial.c  /ECU/components/portable_spc5_hal_component/lib/src   line 149            Semantic Error

Type 'size_t' could not be resolved           serial.c  /ECU/components/portable_spc5_hal_component/lib/src   line 50   Semantic Error

Thanks in advance for your help.

Mike.