0

I want to check if a device is working or not. It is a custom made PCB with a Atmega8. It was given to me along with the AVR code. How do I read the data that it sends on my laptop using a arduino, preferably a Arduino Uno?

I tried connecting the output UART pin to the Rx of the arduino, and then provided the common ground. Then I opened serial monitor on my laptop but I a m not getting anything. Is it because the PCB is damaged or am I doing it wrong?

I have the AVR code which was burned on the IC, so I can provide you with more information if you need.

4
  • Connecting to the RX pin on the Arduino will let the AVR chip receive the data, but not the PC. Try connecting to the TX pin, and making sure the Arduino isn't running anything that would initialize its own UART. Oct 26, 2015 at 18:17
  • @NickJohnson Thanx, would Serial.begin() be what would initialize it's own UART. Oct 26, 2015 at 18:19
  • That's right. Best option is to load an empty sketch, or the 'blink' sketch. Oct 27, 2015 at 7:36
  • @NickJohnson Thank you, and it works perfectly. Can you convert it into an answer so that I can accept it? Oct 27, 2015 at 8:31

2 Answers 2

1

If you connect the TX pin on your device to the 'TX' pin on the Arduino, then load a sketch such as 'blink' that won't initialize the Arduino's own UART, you can use the Arduino's onboard USB-UART adapter to talk to your device.

1
  • 1
    Or just tie the reset pin low so that the serial pins go high-impedance. Oct 27, 2015 at 11:32
0

You can download this example code to your Arduino UNO...

https://www.arduino.cc/en/Tutorial/SoftwareSerialExample

Make sure the baud rate on the line mySerial.begin(4800) to match the baud rate your device is sending.

Then run "Serial Terminal" from the Arduino IDE and connect the output of your device to pin 10 on the Arduino.

If the baud rate is correct, you should see the Serial output from your device in the serial terminal window.

Why you might not want to direct connect

Here is the schematic of the serial port section of the Arduino UNO...

enter image description here

The TX pin on the header is connected directly connected to the TXD/PD1 pin on the ATMEGA chip as highlighted in red. This pin will be actively driven if any of the following happen...

  1. There is a sketch running on the Arduino than enables the serial port (i.e. includes Serial.begin()).
  2. There is a sketch running on the Arduino that enables pin 1 as output (i.e. includes pinMode(1,OUTPUT);).
  3. The Arduino reboots and runs the bootloader, which always briefly enables the serial port on startup.

There are some devices that can be permanently damaged by having their serial output tied to an actively driven signal, especially a +5 volt one like we have here. The BBB is one of them (I know from experience!).

One response suggested downloading the BlinkMe sketch into the Arduino, presumably to make sure there is not another sketch running that could enable the serial port. This is the right idea, but you have to keep in mind that the UNO will reboot anytime the RTS line is toggled. Here is a not-so-far-fetched scenario...

  1. You load BlinkMe into the UNO.
  2. You connect the device to the TX pin on the UNO.
  3. You launch Tools-Serial Monitor from the Arduino IDE to see the serial data.
  4. The Serial Monitor window opens and toggles the RTS line (does this every time you launch it).
  5. The UNO reboots.
  6. The bootloader runs and enables the serial port on the ATMEGA.
  7. The connected device is cooked.

Also keep in mind that even if the attached device can tolerate being connected to an actively driven signal, once you connect another signal to the Arduino TX pin then you loose the ability to communicate with the Arduino.

Loading the Softserial sketch takes the same number of steps as loading the BlinkMe sketch, reduces the chance of of damaging the connected device, and also allows you to keep access to the Arduino while you are doing all this.

1
  • That really isn't necessary, when he could just hook his UART up to the pins used by the Arduino for hardware serial. Oct 27, 2015 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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