2

I'm trying to develop my own OS kernel from scratch for the raspberry pi and I want to be able to debug my code from my computer over putty through a cable. Now I've did a little googling and found out that everybody is using a special cable with a microcontroller on it that does what I'm trying to do but connects to the reasberry Pi's gpio pins instead of its USB port. I was told by someone that the hardware needed to communicate between the RPI and a standard PC already exists on the on the RPI and that I should be able to connect my RPI directly through USB port to my computer's USB port without a special cable containing additional hardware on it and without any Linux USB drivers. Is this true and how do I go about doing this. To clarify I want to get a UART console from rasberry pi over standard USB cable without any OS or drivers installed on the PI.

Thanks :)

1 Answer 1

4

Let me try to un-confuse you :)

In the good old days, computers came with serial ports. The standard is known as RS232. These slowly disappeared, first from laptops and then from desktops. These days, you can use either internal cards, or USB-to-serial adaptors (but read on).

The serial connection on the Pi (also on Arduinos and other such things) is not real RS232: real RS232 signal levels are -3V to -25V for logical one ("mark") and +3V to +25V for logical zero ("space"). What's on the Pi, on these cables you are talking about, Arduinos, and so on, is a TTL-levels version. Obviously, **do not connect* a real rs232 port to your Pi, or you will fry it. You either need a level converter between your Pi and the real RS232 port, or you need a serial adaptor that brings out TTL-level signals. You have to be careful, because there are also a lot of USB-to-RS232 adaptors (they have legitimate uses!).

And that's what the "special cables" you mentioned really are: USB to ttl-level-serial adaptors. Note that they don't normally bring out all the control signals, but what the bring out is usually enough for console debugging. https://www.adafruit.com/products/954 should be good enough.

Also note that "TTL levels" means that the signal can go as high as 5V. I'm pretty sure (but check) that the pins on the Pi are NOT 5V-tolerant. If you only need output (and don't need to type stuff back in), you can just connect the TX pin on the Pi to the RX pin on the cable, and you should be fine (anything over 2.5V will register as "hi"). If you want to go bidirectional, make sure your cable puts out 3.3V, not 5V levels.

One last word: you'll need to set up the proper configuration registers of the SoC to route the UART signals to the GPIO pins.

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.