serial port output/input of DEMO9S08DZ60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

serial port output/input of DEMO9S08DZ60

1,212 次查看
zsdleo
Contributor I

Hi,

I'm coding with the serial port output and input of DEMO9S08DZ60. There is such problem: the output and input is messy code. For example, when in code I want to print a char of 'a', the output of serial port is 0xf8 with ASCII. And the input is with same problem.

Does anybody can tell me what's wrong it is? Is there any problem with configuration or others?

 

Thanks in advance!

标签 (1)
0 项奖励
回复
3 回复数

1,015 次查看
bigmac
Specialist III

Hello, and welcome to the forum.

 

It would seem that you may not have a sufficiently accurate baud rate.  If you are using the internal reference, i.e. FEI mode, to generate the bus frequency, this will need to be trimmed to a specific frequency.

 

The required baud rate divisor setting is given by -

 

BR_divisor = fbus / 16 / baud_rate

 

Some bus frequencies will give more accuracy than others, especially for a high baud rate in conjunction with a low bus frequency.

 

Regards,

Mac

 

0 项奖励
回复

1,015 次查看
zsdleo
Contributor I

Hi, Mac,

 

Thank you for your reply!

 

Here is my configuration of baud rate: fbus is 8MHz, and BR_divisor is 10. Then the baud rate should be 50000. Isn't it?

So I think it is OK.

 

Do you know other possible root cause?

 

BR.

Leo

0 项奖励
回复

1,015 次查看
bigmac
Specialist III

Hello Leo,

 

Assuming that you are using FEI mode to generate the bus frequency, a frequency of 8.000 MHz will require that the internal reference be accurately trimmed for a frequency of 31.25 kHz.  This is achieved by a calibration process, during programming of the device, to store the appropriate trim value at a specific flash memory location.  Your initialisation code then needs to transfer this value to the trim register.

 

If you do not trim the internal reference, the bus frequency will be subject  to substantial unit-to-unit variation, much too wide for SCI operation.

 

Regards,

Mac

 

0 项奖励
回复