vdudouyt / sdcc-examples-stm8

57 stars 28 forks source link

[question] uart connection #2

Closed midnight-wonderer closed 9 years ago

midnight-wonderer commented 9 years ago

Hello, Sorry noob question. Does uart example works with screen? When I try out uart example I connect the controller with a usb uart device and the screen command

screen /dev/ttyUSB0 9600

It will send some data periodically with some delay as expected but all data were garbled. I want to identify if it hardware or software issue so I want some confirmation that my software setup (screen) is correct.

PS. I use 16Mhz internal RC oscillator and already confirm the correctness of value in BRR1 and BRR2.

vdudouyt commented 9 years ago

Hi,

I don't see any problems with your screen command, that's exactly how I'm usually using it. I suggest you to start with writing a blinky program in order to ensure that the clock speed really matches what do you think.

midnight-wonderer commented 9 years ago

You are correct. I don't have time to investigate yet but according to the datasheet I probably run the CPU at 2Mhz. I will recalculate BRR if that the case. Thank you for pointing me the direction.

midnight-wonderer commented 9 years ago

It works now. My master frequency is actually 2MHz. So I have to use BRR1 = 0x0, BRR2=0xd Thanks a lot