week 13
- Networking and communication
- Assignment:design and build a wired network connecting at least two nodes
A very important field is the communication among the boards or devices.
On the tutorial page we find many serial standards, Asynchronous, I2C, SPI or USB.
This protocol works with a start signal, then the byte (8 bit datas) object of the communication and finally a stop signal.
Following each step of the tutorial didn’t save me from a big struggle to succeed in this week assignment.v
I choosed the hello.bus.45 Asynchronous standard and the first step is to build the bridge and the 2 slaves nodes.
The files are on the assignment page, there are the traces and the interior png for both bridge and nodes.
The bridge is different from the nodes for the presence of the FTDI pins.
Second step is to download the .c file and the .make file; both have to be stored on the desktop.
Once the 3 boards are soldered I produced the connection cable with 3 four-pins headers.
Then open the terminal shell (I have a Mac) and navigate to the folder where the 2 files downloaded stay.
Before launching the code, open the .c file and be sure that al line 41, where it indicates
“define node_id”, the number is “0”.
Save it and close. Each of the devices need to have a different sequential number and this operation must be done before programming each board. So the bridge will be “0”, the two nodes “1”, “2”.For programming it is to paste this code on the terminal:
“sudo make -f hello.bus.45.make program-usbtiny”.
I got this error the first times I tried to execute the string:
avr-gcc -mmcu=attiny45 -Wall -Os -DF_CPU=8000000 -I./ -o hello.bus.45.out hello.bus.45.c hello.bus.45.c: In function ‘main’: hello.bus.45.c:220:22: error: variable ‘message’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’ make: *** [hello.bus.45.out] Error 1
At line 220 of the .c file, using the same procedure for changing the identity numbers, it is to add the word “const” at the beginning of the line.
I realized that I used an old .c file.
That worked out both for the bridge and the first node.
I had to fix a weld on the second node, then it worked with the same process for programming the others.
Below you can see a pic of the blinking of the 3 Leds.