2011-04-24 02:47 PM
Hi.
Today I started playing with the STM8-DISCOVERY board, and I tried the RS232/UART example from your website: http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/um0884.zip
After having installed your STVD suite, I got the application programmed into the chip and started debugging. I had the TX and RX pins connected to a USB to UART module, which I have confirmed as working fine.
The text the board should write properly looks like this garbage:
�====================== �T�8ӭ��s��v��y ===================
�Th�s �pp���a���n �s bas�� ��amp�� �� ��RT �n����a�� ���h
�W�nd��s �yp�� T��m�na�
�
�==========================================================
� ���LIC�TIO� �E�� �
�
�==========================================================
�� 1 � ��� L�1 �n
� 2 � ��� L�1 ���
� � � ��� L�1 b��nk
� 4 � �EE�ER O�
� � � �EE�ER OFF
��En��� y�u� �h���� �
As you can see some letters are okey, while most of them aren't. Though the boards recieves serial data fine, and I can turn on and off the led, and make it blink.So the problem seems to be in the sending?!
I've tried making the board send every byte from 1 to 128, and this is the result of that count in hexadecimal:
01 02 83 04 85 86 07 08 89 8A 0B 8C 0D 0E 8F 10
91 92 13 94 15 16 97 98 19 1A 9B 1C 9D 9E 1F 20
A1 A2 23 A4 25 26 A7 A8 29 2A AB 2C AD AE 2F B0
31 32 B3 34 B5 B6 37 38 B9 BA 3B BC 3D 3E BF 40
C1 C2 43 C4 45 46 C7 C8 49 4A CB 4C CD CE 4F D0
51 52 D3 54 D5 D6 57 58 D9 DA 5B DC 5D 5E DF E0
61 62 E3 64 E5 E6 67 68 E9 EA 6B EC 6D 6E EF 70
F1 F2 73 F4 75 76 F7 F8 79 7A FB 7C FD FE 7F
Again, this isn't a correct count. As you might notice, 0x3 = 0x83, 0x5 = 0x85, 0x6 = 0x86 - like it adds 0x80? And it's the same pattern that happens all the time, so the garbaged characters is always the same!Do you have an idea?
Thanks
Best Regards
Thomas Jespersen
#uart-stm8s-stm8-stm8-discovery-garbage-demo2011-05-06 04:24 PM
No one got a clue?
2011-05-09 10:54 AM
Hello Thomas, I'm debugging the same code too, I could run the ST example without problems receiving data, but when I tried to send the number 3 or 5 the STDV debug understand '0xC3' and '0xC5' instead '0x33' and '0x35' respectivelly, as it might be. If you see these two bytes in bynary they differ only for one bit (
0
0110011b for 0x33 and1
0110011b for 0xc3). I think in my case I have a shift of sent data. I'm searching at the UART register inicialization function (UART_BRR1 and UART_BRR2) and see if all is correct.In your case, seems that your MAX3232 is not working well. I recommend you check the hardware (capacitors, and the own MAX IC, and the ground line connecting the two PCB if you are using a protoboard for MAX 232). If this is all correct, you could start verifying the configuration parameters of UART at the hyperterminal: 9600 Baud, no parity, 1 stop bit, no flow control. (obs: I tried to run it at Teraterm and it didn't worked, dunno why, just worked at hyperterminal of winXP)
I Hope it helps
2011-05-10 07:42 AM
Hi
I haven't seen the actual code you're using to generate these characters but it LOOKS like your UART is configured as 7 bits Odd Parity. As a result, bit 7 will be set to a '1' if the total number of '1' bits in the character you're transmitting is even. jdf