Since you are using AVRs, there are examples and code on
formatting link
for SNAP protocol. Look in the app notes section.
I also use SNAP extensively, although on wired RS485 links, but the principles are the same.
--
Regards,
Adrian Jansen adrianjansen at internode dot on dot net
Design Engineer J & K Micro Systems
Microcomputer solutions for industrial control
Note reply address is invalid, convert address above to machine form.
Could you please explain some more what I require to send from the transmitter?
It is becuase I only found the example from receiver side.
What I think on the Receiver side is -
Wait for the serial signal to come in, check the sync byte, header byte and CRC, if all correct then read the data byte and send ACK, send NAK if incorrect.
However, What I need to send from the transmitter as I am doing a wireless transmission? Do I have to do in two way transmission?(send feedback ACK/NAK).
On the transmit end you generate all the correct sync, header, address bytes and data packet, plus of course the CRC. Then send it as a SNAP packet. Did you look at AN101 as I suggested ?
formatting link
This has a code example for AVR with both transmit and receive.
Radio transmission has some special requirements, depending on exactly what your Tx/Rx pair already does. If it does the encoding to fix DC offsets - eg Manchester encoding - then you just give it byte strings, and get them back. Else you need to do more stuff.
But as long as you use relatively short packets, less than 40 bytes is recommended, and at least 16 bit CRC, then it should work ok. Yes you need to do something useful at the Tx end if the Rx signals a bad packet. Depends on what you are sending - eg if you regularly send updated data, then a bad packet is just ignored, and the next one is used. But if you only send one packet containing vital data, then you must have a way to repeat it if its rejected.
I see you already post on MCS electronics forum, so maybe that is a better place to go into more details.
--
Regards,
Adrian Jansen adrianjansen at internode dot on dot net
Design Engineer J & K Micro Systems
Microcomputer solutions for industrial control
Note reply address is invalid, convert address above to machine form.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.