Rather than using an existing protocol, we decided to delve a little deeper by going through the process of designing and implementing a simple communications protocol based on UART.
As we wanted multiple boards in the network, we could not easily use a normal 2 wire UART line with dedicated TX and RX lines, instead we opted for a half duplex communications protocol utilising a single transmission line and a second signalling line to be used for a simple collision avoidance system.
My major project for this week was to get a library working for the rest of the team to use. I found an excellent starting point with the Software Serial with Half Duplex library.
From that starting point, I have been busily developing a tailor-made solution that implements the WellyNet protocol, my work so far is up on GitHub and implements the following features:
- Half Duplex Transmission
- 8 bit addressing
- Packet Contstruction (Receiving)
- ISO 1155 Longitudinal Redundancy Check calculation
- Do-Not-Disturb line implementation
- Fix the spurious byte problem in the receive code
Testing the Reference Boards
To test the library I used an Arduino Uno as a bridge between my laptop and the WellyNet reference board and configured the WellyNet board to simply respond when it received a message, you can see on the oscilloscope in the picture a single byte of data being transmitted to the WellyNet board by the Arduino Uno and the WellyNet board responding with 2 bytes of data.
I did however encounter an issue, the signalling worked but it was sporadically garbled, upon closer inspection I noticed that the timing was ever so slightly out for the messages being returned from the WellyNet reference board, After double checking the code I figured out it was likely to do with clock skew on the internal oscillator given the factory calibration is only good to about 10%*, I could either attempt to manually trim the clock for each board in the network or move to a crystal oscillator as part of the standard. After discussion with the other students we decided to require a crystal oscillator for any boards participating in WellyNet.* - According to table 20.4.1 of the ATTiny44 Datasheet.
Testing the Protocol
We have successfully tested the protocol using ATTiny44, ATTiny45 and ATMega328P microcontrollers, as of this moment the WellyNet protocol uses about 3 kB of program storage, I intend to continue working on reducing the size of the library by purging features included from it's heritage as the standard SoftwareSerial library that are no longer needed in WellyNet.
As the WellyNet specification uses the existing ISP headers I was able to use boards I had designed in previous weeks. We did however develop a set of reference boards that implemented the bare minimum required for WellyNet connectivity, these were expertly developed by Jasmin, Geoff, Ben and Craig.