RS-232 SPI CONTROLLER – part 2
by languer , 31st January 2012 at 06:14 AM (1691 Views)
This second part is more of a let’s play with this a little, than actually something truly new. How can we put the SPI controller to use. This may not be the best application, but we’ll this circuit to control the same NS73M FM module described previously (http://www.electro-tech-online.com/b...ansmitter.html). The use is quite simple: connect to the SPI Controller, send RS232 commands to perform the same initialization and control of the NS73M module as was done with the PIC on the other post. So what is really accomplished with this? Nothing really. But if you want to perform a quick evaluation of SPI modules, this does provide the opportunity. I also used the opportunity to create a RealStudio (http://www.realsoftware.com/realstudio/) application just because I wanted to do a nifty interface; but this could have been easily done with a simple RS232 terminal.
A few caveats:
• The NS73M module requires a 4-bit address and an 8-bit command. To properly send this over the SPI Controller, the 4-bit address must be padded with zeroes.
• The SPI communications to the NS73M module is send lsb first, but broken down by address and data. So the address is sent lsb-first, and then the data is sent lsb-first.
ns73m spi communications.png
• All this means is that the RS232 interface has to properly handle this. For example, on our RealStudio application the address bits were reversed and the resultant nibble (4-bits) padded with 4 zeroes. Then the data bits were reversed and appended to the end of the modified address byte.
ns73m RealStudio Interface.png
One more thing: I’ve been trying for a while to test my new Saleae LOGIC device, and this presented a cool way of trying it. Below is a snapshot of the first command. To read it properly one has to remember that the address byte is really a nibble. For example, 0x05E0 on the analyzer is really 0xE for the address nibble and 0x05 for the data byte.
ns73m Saleae Logic.png
Can’t say enough cool things about this nifty tool. The table below comes from a text file the LOGIC tool spits out with the decoded serial data:
ns73m Saleae Logic Output File.png
Well that’s it for now, next we’ll try to add the read capability (i.e. bidirectional).