martes, 10 de marzo de 2015

Practice SPI


Then SPI practice occurs. We have a ATMEGA328P microcontroller that is on the Arduino board that controls the process.
Through the SPI protocol I entered values ​​that are in the code you what is displayed in the Source Code tab.
The practice is to send values ​​to a slave who has 6 potentiometers the name of this device is AD5206BN10. The protocol used for the communication is SPI.
Captura1
Communication is observed on the monitor of SPI's like going the whole process starts with the micro bootloader to start work, once completed this boot begins to execute the instructions contained in the code. Instructions ranging from master to slave codes are 8 bits in the last three are for the direction of the potentiometer and the other 8 is to put the potentiometer value from 0 to 255. The transfer starts with falling edge to select the potentiometer SS and clock signals going through the MOSI sending 8 bits.
Captura2
In the SPI debugger see how choose the potentiometer and then sends the data. The control to choose the potentiometer will be 0 0 0 0 0 0 0 0 0 0, 1, 0 0 1 ...... and so do 6 potentiometers. In this case the master does not hear the slave because it has MISO therefore continue to send information to be proven. After this information, it will send the same way a command whose control code is the value we want to take the Ohm-meter followed potentiometer byte size we want for example the number 216 and we displayed in hexadecimal as D8.
Captura3
After pressing the PLAY button located at the bottom of the screen, it will run once and ending with the entered values, which start from an increased 1.5K 1.5K potentiometer, ie the potentiometer 1 display a value of 1.5K, 3K 2nd and so on with the 6 potentiometers.
I placed an intermediate SPI instrument that shows what is going on while the program is running.
This tool helps us when we perform breakpoints and have a detailed process information.
The 6 potentiometers are inside the integrated AD5206BN10, it has some entries which are CLK, SDI and CS.
The CLK input is for the SCK is the clock for the slave.
The teacher sends clock pulses to receive the slave with pulses of orders should receive.
The SDI is the input that has a slave to hear the teacher.
The CS input in this case is denied because you choose active low, if we had more integrated or other device with the same protocol through this pin the teacher chooses who send an order.

To download the files from all the practice you must click on the picture below.


1 comentario: