MarcosBontempo
Posts: 23
Joined: Fri May 31, 2013 3:10 pm

Project: TCP/IP, UART and GPIO

Sat Jul 27, 2013 10:43 pm

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.

PiHeich
Posts: 25
Joined: Sun Jul 14, 2013 8:48 pm

Re: Project: TCP/IP, UART and GPIO

Sun Jul 28, 2013 1:08 pm

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

MarcosBontempo
Posts: 23
Joined: Fri May 31, 2013 3:10 pm

Re: Project: TCP/IP, UART and GPIO

Sun Jul 28, 2013 2:53 pm

PiHeich wrote: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
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?

MarcosBontempo
Posts: 23
Joined: Fri May 31, 2013 3:10 pm

Re: Project: TCP/IP, UART and GPIO

Sun Jul 28, 2013 2:57 pm

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?


User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Project: TCP/IP, UART and GPIO

Sun Jul 28, 2013 11:43 pm

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.

PiHeich
Posts: 25
Joined: Sun Jul 14, 2013 8:48 pm

Re: Project: TCP/IP, UART and GPIO

Mon Jul 29, 2013 1:38 pm

you can download the wiringPi source code and read the examples and read the source code of include. :)

MarcosBontempo
Posts: 23
Joined: Fri May 31, 2013 3:10 pm

Re: Project: TCP/IP, UART and GPIO

Mon Jul 29, 2013 8:04 pm

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?

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Project: TCP/IP, UART and GPIO

Tue Jul 30, 2013 5:23 am

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!

PiHeich
Posts: 25
Joined: Sun Jul 14, 2013 8:48 pm

Re: Project: TCP/IP, UART and GPIO

Tue Jul 30, 2013 9:13 am

AndyD wrote:
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!

Yes, and when you download you can watch into the folder the code ^^

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Project: TCP/IP, UART and GPIO

Wed Jul 31, 2013 10:44 am

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
--
Gordons projects: https://projects.drogon.net/

Return to “C/C++”