Hi all
I'm new to mbed and SPI.
I really have a little knowledge on how to program all of this device .
I have to read the register value from TC77 (http://ww1.microchip.com/downloads/en/devicedoc/20092a.pdf) but i don't understand much on how to read the value from The SPI.
#include "mbed.h"
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
SPI spi(p5,p6,p7);
DigitalOut ss(p8);
int main() {
spi.format(8,0);
spi.frequency(100000);
wait(1);
pc.printf("SPI formet: 8,0\nSPI frequency = 1kHz\n");
ss=0;
pc.printf("chip selected enable\n");
int Temp1 = spi.write(0x00); //I'm not sure about this one bit i see this on the hand book iint whoami = spi.write(0x00);
int Temp2 = spi.write(0x00); //The data i should receive is 16 bit so this is the second 8 bit data
pc.printf("register value Temp1 = %d Temp2 = %d\n",Temp1,Temp2);
ss=1;
pc.printf("chip selected disable\n");
}
What i got is Temp1 = 0 and Temp2 = 0
I try to look at the datasheet and check whether i should send any command to the tc77 but i couldn't find out ( It said in the datasheet that tc77 will send the data after cs was enable If i don't miss understand).
Any help would be appreciated.
Thank you
Hi all
I'm new to mbed and SPI.
I really have a little knowledge on how to program all of this device .
I have to read the register value from TC77 (http://ww1.microchip.com/downloads/en/devicedoc/20092a.pdf) but i don't understand much on how to read the value from The SPI.
#include "mbed.h"
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
SPI spi(p5,p6,p7);
DigitalOut ss(p8);
int main() {
spi.format(8,0);
spi.frequency(100000);
wait(1);
pc.printf("SPI formet: 8,0\nSPI frequency = 1kHz\n");
ss=0;
pc.printf("chip selected enable\n");
int Temp1 = spi.write(0x00); //I'm not sure about this one bit i see this on the hand book iint whoami = spi.write(0x00);
int Temp2 = spi.write(0x00); //The data i should receive is 16 bit so this is the second 8 bit data
pc.printf("register value Temp1 = %d Temp2 = %d\n",Temp1,Temp2);
ss=1;
pc.printf("chip selected disable\n");
}
What i got is Temp1 = 0 and Temp2 = 0
I try to look at the datasheet and check whether i should send any command to the tc77 but i couldn't find out ( It said in the datasheet that tc77 will send the data after cs was enable If i don't miss understand).
Any help would be appreciated.
Thank you