MOD54415 peculiar QSPI issue
Posted: Thu May 02, 2013 7:24 am
Hi,
I am trying to read data from an IMU (http://www.analog.com/static/imported-f ... S16488.pdf). The way this works is, netburner sends a comamnd to IMU via SPI3 and IMU responds with the corresponding data. So my code looks like.
In this case when I am reading the POPR register, the xahigh value is in IMU_raw[0] but IMU_raw[1] has zahigh value instead of yahigh and IMU_raw[2] is showing a '0' value. Then I replaced the above code with the following one.
Now the first 3 entries of IMU_raw array are still messed up in the same way as before but IMU_raw[3],IMU_raw[4], IMU_raw[5] show the correct value corresponding to their command. I again modified the above code to include same sets of command again and still the first 3 entries are messed up but IMU_raw[3],IMU_raw[4], IMU_raw[5],IMU_raw[6],IMU_raw[7], IMU_raw[8] show the correct value. I am kind of confused,would like to know what other people faced while implementing QSPI on MOD54415. Also the transmission complete bit is set for each transfer or it is set when the entire contents of TX FIFO is shifted out? Using EOQ bit in PUSHR register to represent end of commands transmission, stops the receiving also and I end up with "0" in IMU_raw array.
Thanks in advance,
TM
I am trying to read data from an IMU (http://www.analog.com/static/imported-f ... S16488.pdf). The way this works is, netburner sends a comamnd to IMU via SPI3 and IMU responds with the corresponding data. So my code looks like.
Code: Select all
#define xahigh 0x00001E00 //command to IMU for MSB of Xaccel
#define yahigh 0x00002200 //command to IMU for MSB of Yaccel
#define zahigh 0x00002600 //command to IMU for MSB of Zaccel
void initIMUspi()
{
J2[21].function(1);//SPI3 Input
J2[22].function(1);//SPI3 Out
J2[23].function(1);//SPI3 chip select 0
J2[24].function(1);//SPI3 clock
sim1.dspi3.ctar[0]=0x7E020006; //SPI Transfer protocol
}
void readIMU()
{
sim1.dspi3.pushr=0x04FF0000|xahigh;
sim1.dspi3.pushr=0x04FF0000|yahigh;
sim1.dspi3.pushr=0x04FF0000|zahigh;
sim1.dspi3.mcr =0x81FF0000;//Starting Transfers
while(((sim1.dspi3.sr & 0x0000F000)>>12)>0){}//Waiting for transfers to complete
//reading POPR
IMU_raw[0]=(short int)sim1.dspi3.popr;
IMU_raw[1]=(short int)sim1.dspi3.popr;
IMU_raw[2]=(short int)sim1.dspi3.popr;
sim1.dspi3.mcr=0x81FF0C01;//Stop Transfers
}
Code: Select all
#define xahigh 0x00001E00
#define yahigh 0x00002200
#define zahigh 0x00002600
void initIMUspi()
{
J2[21].function(1);//SPI3 Input
J2[22].function(1);//SPI3 Out
J2[23].function(1);//SPI3 chip select 0
J2[24].function(1);//SPI3 clock
sim1.dspi3.ctar[0]=0x7E020006; //SPI Transfer protocol
}
void readIMU()
{
sim1.dspi3.pushr=0x04FF0000|xahigh;
sim1.dspi3.pushr=0x04FF0000|yahigh;
sim1.dspi3.pushr=0x04FF0000|zahigh;
sim1.dspi3.pushr=0x04FF0000|xahigh;
sim1.dspi3.pushr=0x04FF0000|yahigh;
sim1.dspi3.pushr=0x04FF0000|zahigh;
sim1.dspi3.mcr =0x81FF0000;//Starting Transfers
while(((sim1.dspi3.sr & 0x0000F000)>>12)>0){}//Waiting for transfers to complete
//reading POPR
IMU_raw[0]=(short int)sim1.dspi3.popr;
IMU_raw[1]=(short int)sim1.dspi3.popr;
IMU_raw[2]=(short int)sim1.dspi3.popr;
IMU_raw[3]=(short int)sim1.dspi3.popr;
IMU_raw[4]=(short int)sim1.dspi3.popr;
IMU_raw[5]=(short int)sim1.dspi3.popr;
sim1.dspi3.mcr=0x81FF0C01;//Stop Transfers
}
Thanks in advance,
TM