0
\$\begingroup\$

I am using ATtiny2313 microcontroller along with a RS232 to establish communication between my microcontroller and the laptop. Here's my question : What is the predefined system for the laptop to make sense of the data that i send using the microcontroller ? (i.e. what is the number of parity bits, start bits... that the laptop expects to make sense of the data ?)

I tried reading the data using python but all data reads 0xff my avr code sends a constant byte 0x01010101 every one seconds and laptop detects every new byte every 1 second. But every byte is sensed as 0xff. What could be the problem ? (i am using the screen function in the mac terminal to view the RS232 data).

Please help

\$\endgroup\$
  • \$\begingroup\$ Is baud rate same on both sides? \$\endgroup\$ – Swanand Mar 23 '15 at 10:39
  • \$\begingroup\$ @Swanand YES ! the baud rate is 9600 on both the sides. I also checked it using a DSO \$\endgroup\$ – ironstein Mar 23 '15 at 10:40
  • \$\begingroup\$ Baud rate, Parity, Start Bit, Stop Bit settings can be anything but both should be same on Computer and Microcontroller. Set Handshaking to OFF on Computer (if you are not planning to use RTS-CTS lines) \$\endgroup\$ – Swanand Mar 23 '15 at 10:41
  • \$\begingroup\$ @Swanand i crosschecked everything. Still reading 0xff only \$\endgroup\$ – ironstein Mar 23 '15 at 10:52
  • \$\begingroup\$ Can you check on any other terminal application? If that is receiving data correctly, then it is issue with your Python code... If it is also receiving 0xFF, then issue with Configuration \$\endgroup\$ – Swanand Mar 23 '15 at 11:03
1
\$\begingroup\$

make sure that the baud rate, number of parity bits, start bits and stop bits are same in your microcontroller and in your serial terminal program. In every serial terminal applications there are options to set the number of parity bits, start bits e.t.c. So the terminal program expects data in the format which is defined by the you. Install any other serial terminal application and check to see the correct byte is received. If the correct bit is received then it may be the problem with your python program.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.