Page 1 of 1
Project: TCP/IP, UART and GPIO
Posted: Sat Jul 27, 2013 10:43 pm
by MarcosBontempo
Hello friends,
I'm making a project for a fair at school and I'm using the Raspberry Pi. I have to get three functions:
- Communication with a PC over the Ethernet port using TCP sockets;
- Communication with a microcontroller using UART;
- Control GPIO pins and a LCD display.
I had some experiences using the RPi.Library but I prefered to use the WiringPi library. I already concluded the codes for the GPIO pins and for the display but I need help with the UART and mainly with the TCP sockets. Can someone give me a example of it and teach me how can I use? I don't know how can I read and write TCP sockets. I'm waiting for your help because I have to finish this by september hahahaaaa
Thanks.
Re: Project: TCP/IP, UART and GPIO
Posted: Sun Jul 28, 2013 1:08 pm
by PiHeich
begin whit this uart setting,
http://www.irrational.net/2012/04/19/us ... rial-port/
i make a UART communication whit pc an microcontroller for a school project. If you need help

For UART is very simple. You can look in internet some examples
Re: Project: TCP/IP, UART and GPIO
Posted: Sun Jul 28, 2013 2:53 pm
by MarcosBontempo
Thanks for the help! I followed this link and now I don't know how can I send and read bytes with the minicom. But how did you make this communication with the microcontroller? Can you show me your code?
Re: Project: TCP/IP, UART and GPIO
Posted: Sun Jul 28, 2013 2:57 pm
by MarcosBontempo
I'm using a MSP430G2553 and it has two buffers that store the informations of the transmitter and of the receiver. Does the Raspberry have buffers like these? How do you manipulate the data?
Re: Project: TCP/IP, UART and GPIO
Posted: Sun Jul 28, 2013 3:11 pm
by MarcosBontempo
Re: Project: TCP/IP, UART and GPIO
Posted: Sun Jul 28, 2013 11:43 pm
by AndyD
MarcosBontempo wrote:- Communication with a PC over the Ethernet port using TCP sockets;
There is a large amount of information on the internet about writing TCP client/server code in C. I see from your other posts that you have been writing some Python. You could also write the client/server in Python. Perhaps have a go and post back with more specific questions if you have trouble.
Re: Project: TCP/IP, UART and GPIO
Posted: Mon Jul 29, 2013 1:38 pm
by PiHeich
you can download the wiringPi source code and read the examples and read the source code of include.

Re: Project: TCP/IP, UART and GPIO
Posted: Mon Jul 29, 2013 8:04 pm
by MarcosBontempo
PiHeich wrote:you can download the wiringPi source code and read the examples and read the source code of include.

Hello, thanks for replying. I searched for the wiringpi source code but I didn't find anything. Can you say me the link?
Re: Project: TCP/IP, UART and GPIO
Posted: Tue Jul 30, 2013 5:23 am
by AndyD
MarcosBontempo wrote:Hello, thanks for replying. I searched for the wiringpi source code but I didn't find anything. Can you say me the link?
Hi if you
google wiringpi the first four links are
Gordon's (the author of Wiring Pi) project page for Wiring Pi
Gordon's download and install instructions for Wiring Pi
Gordon's new Wiring Pi page
The github repository for Wiring Pi
Googling
wiring pi source code gets the same list (only in a slightly different order). Take a look at the
download and install instructions and ask back here if you have any problems. Gordon is often on this forum and is
very helpful!
Re: Project: TCP/IP, UART and GPIO
Posted: Tue Jul 30, 2013 9:13 am
by PiHeich
Yes, and when you download you can watch into the folder the code ^^
Re: Project: TCP/IP, UART and GPIO
Posted: Wed Jul 31, 2013 10:44 am
by gordon@drogon.net
MarcosBontempo wrote:PiHeich wrote:you can download the wiringPi source code and read the examples and read the source code of include.

Hello, thanks for replying. I searched for the wiringpi source code but I didn't find anything. Can you say me the link?
If you look in the examples directory for serialRead.c and serialTest.c you'll find 2 little programs that show you how to set it up and use it.
If you look in the wiringPi directory for a file called drcSerial.c you'll find another set of libraries that use it to communicate with a remote device over the serial port too.
-Gordon