fiftyseven
Posts: 2
Joined: Tue Oct 30, 2012 12:25 am

Cannot make dwelch's uart examples work

Tue Oct 30, 2012 12:39 am

I have connected my raspberry pi's rx, tw, ground and +5v to a windows computer using this adapter/cable:
http://www.adafruit.com/products/954
The adapter shows up as a serial port and I set it to 115200 baud, 8 bit data, 1 stop bit, no parity, no flow control in the driver settings. I also used these settings in PuTTY to connect to the uart.

I have previously compiled dwelch's blinker examples and have written my own code to make the LED blink, this worked fine. I compiled the first uart example in the same way, however, nothing is ever received from the connection when the Pi is started. I tried the second example, and again, nothing is received when the pi is started. However, when I type into the terminal, sometimes, a seemingly random character will appear instead of the charcter I typed, and when I press enter the cursor moves back to the start of the line instead of starting a new one. The terminal also stops accepting input for a few seconds sometimes.

Does anyone know what the problem could be here?

gertk
Posts: 52
Joined: Mon Aug 29, 2011 9:08 am

Re: Cannot make dwelch's uart examples work

Tue Oct 30, 2012 6:37 am

I also tried to power the Pi from the USB port of the host computer but it did not work, at least not when I got a power switch in between the +5 of the USB serial adapter and the Pi. Everytime I switched on the Pi the USB port got reset and the serial adapter quit working. At the moment I use the RS power adapter with a power switch in the +5V cable.

Make sure you have the right pin for ground connected to the serial adapter and also make sure you cross wire TX and RX (RX goes to TX and TX goes to RX, at least with my FT232BOB module) You can leave the 5V supply from the serial adapter unconnected.

During testing I simply made the Pi continuously emit an 'A' on the serial output with a small delay inside the loop. If the connection is succesfull you will see this in the terminal.

Next step will be receiving characters on the Pi.
note: there are some errors in the original pdf's from Broadcom.

fiftyseven
Posts: 2
Joined: Tue Oct 30, 2012 12:25 am

Re: Cannot make dwelch's uart examples work

Tue Oct 30, 2012 8:17 am

I removed the 5v wire and powered it from the mini-usb port, and it still didn't work, so I tried it again with the rx and tx cables switched around and it worked perfectly! Thank you.

dwelch67
Posts: 954
Joined: Sat May 26, 2012 5:32 pm

Re: Cannot make dwelch's uart examples work

Wed Oct 31, 2012 1:57 pm

Good thing you didnt fry something doing that. Need to be careful driving two outputs against each other. Next time verify the rx label on the host side is really a receiver (docs website, etc), then only use rx until you can see characters using a program that blasts characters on the target side. Once you see characters then hook up tx. Reduces the odds of melting something down, not much of a reduction but a reduction nevertheless.

David

gertk
Posts: 52
Joined: Mon Aug 29, 2011 9:08 am

Re: Cannot make dwelch's uart examples work

Thu Nov 01, 2012 6:53 am

When in doubt you can always insert a resistor of 100 to 500 ohms in series with the TX and RX lines and remove if necessary when it is working.

Return to “Bare metal, Assembly language”