* For this week assignment, I have finished an One-to-manu communciaiton with UART. However, as most of you guys know, UART can only be used in one-to-one communication, it not fit for one-to-many communication. So how it works in my case?
(This assignment I started to design it since 5 weeks ago, and it also a part of my master thesis.)
1. UART interface
UART is an interface has been very widely used in embedded system. It usually be used in connecting controller to different models like Bluetooth, GPS, or sensors and etc. It only has tow wires for connectiong, Tx and Rx.
2.One-to-many UART hardware connection
All the slave Tx ports are connected to Rx port of master via one common wire and all the slave Rx ports are connected to Tx port of master via another common wire. The two wires can be called ’bus’ and all the messages will be transmitted through these two bus.
3. Hardware design
The sytem for testing my algorithm are based in Arduino. And an external circuit board has been made. It includes 4 Keys, 4 LEDs, 1 Display, and one UART interface that is led out with 4-pin plugs.
The board was designed by eagle.
And finally, after the milling and sodering to the board as we did last weeks. The circuit board was made, which be repeated for 4 times.... AS in there assignment, I will use one board to communicate with the other 3 boards.
4. Software design issues
To achieve the goal of one-to-many communication, these issues must be solved.
1. Tx from slaves should be set as input mode when it not sending, to allow others to send on the bus.
2. Address based protocol to be designed, so that it can be recognized as different communicaiton addresses
3. Communication collisions avoidance (when several slaves want to send massage at the same time)
One thing I would like to show is the pack designing to have the message correctly sent to others. The pack fram designed like showed on the table.
It is too long to discuss more about the whole protocol in very detail. I design a experiment system and the code is here.
To use the code, Arduino IDE been used for compiling and programing. In the code file. We have 2 versions of codes, Master and Slave.
1. For the master version, just downloadit.
2. For the slave version, you need change the address on the head of the code
The experiment opertated as:
1.If the key of master been pushed down for a time T, the number T will be sent to the corresponding slave. And the slave will show the number T.
2. Any key of slave been pushed, a number of T also will be sent to the master. And the master will display the number T, also the master can get the address of that slave.