Today we're going to do the ESP8266.
The 1-ping-pong
lab has a client and a server program. You should be able to
plug in two esp's and run the server using one tty and the client on the other.
- start there server first.
- after it is waiting for data, then start the client.
- they should send hello messages back and forth.
- There are logs in the directory after each run. You can also switch
between input options in
libesp/esp-lex.h
which gives and example of usingifdef
to switch between implementations.
Deliverables: today is kind of a light lab:
-
You can ping-pong a value with your patner using TCP. This will be the stepping stone for building a
net_GET32
andnet_PUT32
needed by the homework. -
You can run the sw-uart.
-
Do something interesting with the esp (below).
Before getting into the interrupt code, we will just debug that the
esp8266
device you have actually works.
Before connecting, the most important rule for connecting the esp8266 to either your tty-USB device or your pi:
MAKE SURE YOU ONLY CONNECT TO THE 3V (NOT THE 5V)
MAKE SURE YOU ONLY CONNECT TO THE 3V (NOT THE 5V)
MAKE SURE YOU ONLY CONNECT TO THE 3V (NOT THE 5V)
MAKE SURE YOU ONLY CONNECT TO THE 3V (NOT THE 5V)
MAKE SURE YOU ONLY CONNECT TO THE 3V (NOT THE 5V)
It will fry, and I only have so many of them.
How:
-
Hook up the esp8266 to your tty-USB and plug it into your laptop.
-
You should be able to run the server code above and see stuff going out.
The code you'll modify is in the libesp/esp-commands.c
. First make
sure the ping pong works. Then start generalizing it.
Copy the ping pong code to a new directory:
-
Change it so you can do a
PUT32
and aGET32
and the values are correct back and forth. -
Measure the overhead.
Start adding functionality to your libesp
. Please keep all your code in
esp-commands.c
so that I can push any bug-fixes without conflicts.
-
Try to handle mutiple client connections. this will require you can accept
CONNECT
andDISCONNECT
messages during normal message processing --- you will need to modify the out-of-order messages handler to do this. Connect from multiple esps. -
Handle errors. for the client, write the code to do a close and modify the server to handle it. Also, have the client reboot (versus getting stuck) if the server goes away.
I checked in a hardware cs140e-objs/uart-int.o
--- add this to your
put-your-src-here.mk
and run the example to make sure things work.
You can start writing the pi-support.c
code in libesp
and getting the
code to run.
Will write this up this week. Due two weeks after.
When you have the above working, make network versions of the GPIO
routines
and control another pi.
Will write this up this week. Due two weeks after.