HS908SH8 - SCI module wrong data transmited/received

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HS908SH8 - SCI module wrong data transmited/received

890 Views
luxarts
Contributor I

Hello! I'm trying to do a simple program to send a byte from the MCU to the PC and read it with a serial monitor. I'm using an USB-Serial interface (that works fine because a friend is using it with his project).

 

The problem: When I send the byte (a 65 for example that it's an 'A' in ASCI) I get a trash character in the serial monitor. When I send 0x41 (the 'A') I get 0xA1 in the monitor. I set up the MCU at 8Mhz and the Baud Rate to 9600. Of course I'm reading at 9600 with the monitor. I can't find the error if it's a code problem or it's a electronic problem.

 

I'll post my code in an external link because I think it's too large to post in a normal mesage. I'll attach the code too if you want download.

 

http://pastebin.com/yeKDt1gB

 

Thanks for reading, I hope you can help me!

 

Lucas

Original Attachment has been moved to: SCI-Test.c.zip

Labels (1)
0 Kudos
3 Replies

609 Views
david_diaz
NXP Employee
NXP Employee

Hello Lucas,

I have already tested you code using the DEMO9S08SH8 and I had no problem. The code runs perfectly.

Please make sure about your hardware connection.

In this case, I recommend to use the DEMO9S08SH8 mentioned as a reference.

Please find the corresponding schematic at:

DEMO9S08SG8_SH8_SCH_B.pdf

I hope this information will be useful for you.

If I misunderstood your question, feel free to let me know.  I will be glad to help.

Have a great day.

David Diaz.

0 Kudos

609 Views
luxarts
Contributor I

First, thanks for the reply.

The data sent and received it's the same? This makes me think that the problem is in the USB-Serial converter.
I'm using an Arduino UNO board (without the MCU of course) connecting TX and RX from HCS908 SH8 to the board and reading with several terminals. The Arduino UNO has a Atmega8u2 to convert Serial to USB and viceversa. I'll replace it with a normal FTDI conversor or triying with a PC with serial port.

Again, thanks for the responses. If you know something about using the Arduino board as USB-Serial interface makes me know.

Greetings,
Lucas.

0 Kudos

609 Views
tonyp
Senior Contributor II

Are you using correct clock source, and if internal one is used, are you trimming your MCU?

0 Kudos