Edited 26MAR15
The SNA hardware communicates with the host PC using a USB virtual COM port on the PC running at 115,200 baud. Virtual COM is the method used by USB-RS232 converters to make a USB interface look like a COM port on the PC. The microcontroller on the Arduino Nano board that I use has a CH340 USB-RS232 chip. The PC used for the SNAP! software will probably require installation of drivers for this chip. I’ll post a link to the download site for the driver.
The protocol is pretty simple and looks like this:
- All transactions are initiated by the PC.
- The PC sends a message to the Nano that has the following format: “<“, Command Byte, “=”, abcd, “>”. The “<=” and “>” frame the 4 byte “abcd” data payload from PC to Nano. The Nano will not reply unless the message is properly framed.
- Command byte “1” (binary byte; not ASCII) sends the 4-byte sweep start frequency in binary data bytes “abcd”. This binary number, which is calculated by the PC, gets fed directly into the AD9850 DDS chip by the Nano.
- Command byte “2” sends the frequency step that gets added by the Nano to the DDS load frequency for each of the successive 1024 sweep steps.
- Receipt of the “2” command will trigger the Nano to load the DDS with a frequency (last freq + step), make a 10-bit A/D measurement of the log detector output, and send the result back to the PC as a 2-byte binary number (16 bit word). Consequently, each successful PC-Nano transmission of command “2” results in the Nano sending 2048 bytes (1024 words) that represent 1024 10-bit measurements.
- The PC presently gives the Nano 250 Msec to finish its work before sending the next request. This could change.
- It’s possible that additional commands will be added for other purposes in the future, but for now there are only two.
- The Nano sends nothing back to the PC at this time except the 2048 bytes of measurement information. It’s possible the protocol will be extended in the future to accommodate other return data.
Joe
Leave a Reply