Problem with DSPI in MOD54415
Problem with DSPI in MOD54415
Hi,
I asked this before and users here told me that my IDE may not be up to date so I am sorry to ask the same question again. So I have a code which reads data from IMU via the SPI3 in MOD54415. I have a desktop (WIN 7) with NBEclipse 2.6.2 and when I upload the code from that desktop, I get data from IMU. If I upload the same code to MOD54415 from a laptop (WIN 8.1) with NBEclipse 2.6.5 I don't get any data from IMU. They are all zeros, I have checked the DSPIStart and DSPIInit status they don't return any error messages. Also DSPIdone returns true for each DSPI communication. I will appreciate any suggestions and help regarding this problem. Thank you in advance.
Regards,
TM
I asked this before and users here told me that my IDE may not be up to date so I am sorry to ask the same question again. So I have a code which reads data from IMU via the SPI3 in MOD54415. I have a desktop (WIN 7) with NBEclipse 2.6.2 and when I upload the code from that desktop, I get data from IMU. If I upload the same code to MOD54415 from a laptop (WIN 8.1) with NBEclipse 2.6.5 I don't get any data from IMU. They are all zeros, I have checked the DSPIStart and DSPIInit status they don't return any error messages. Also DSPIdone returns true for each DSPI communication. I will appreciate any suggestions and help regarding this problem. Thank you in advance.
Regards,
TM
Re: Problem with DSPI in MOD54415
Are you connected to the correct SPI module on the MOD5441X? (the default module is set in 'dspi.h')
-Dan
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Problem with DSPI in MOD54415
Yes I am opening the DSPIInit with DSPI 3 which is hooked up to my IMU i.e the first argument of DSPIInit function in my code is 3 which should not use the default DSPI 1 as defined in dspi.h.
Regards,
TM
Regards,
TM
Re: Problem with DSPI in MOD54415
Do you have any sort of logic analyzer that you could get a bus capture from? Are you certain that you have the pins configured properly for SPI operation? Can you post the section of troublesome code?
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Problem with DSPI in MOD54415
I will try to get hold of a logic analyzer and check the signals. Regarding your question whether I have configured the PINS correctly, I am using the exact same code that I upload from the desktop (WIN 7) with NBEclipse 2.6.2. The only thing I am doing differently is uploading the same code from a laptop (WIN 8.1) with NBEclipse 2.6.5. Below is the part of the code which does the reading from IMU
Code to initialize the DSPI
Code to configure the PINS
Regards,
TM
Code: Select all
DSPIStart(1,IMU_command,IMU1_raw,24,NULL);//IMU1
while(!DSPIdone(1)){/*iprintf("DSPI1done state=%s\n",(DSPIdone(1))?"true":"false");*/};
DSPIStart(3,IMU_command,IMU2_raw,24,NULL);//IMU1
while(!DSPIdone(3)){/*iprintf("DSPI3done state=%s\n",(DSPIdone(3))?"true":"false");*/};
Code: Select all
DSPIInit(3,2000000,16,0x01,1,1,1,0,0,0);//initializing SPI 3
DSPIInit(1,2000000,16,0x01,1,1,1,0,0,0);//initializing SPI 1
Code: Select all
//IMU 2
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
//IMU 1
J2[27].function(1);//SPI1 Input
J2[28].function(1);//SPI1 Out
J2[30].function(1);//SPI1 chip select 0
J2[25].function(1);//SPI1 clock
TM
Re: Problem with DSPI in MOD54415
Hmm... I think I may know what the issue is. For your chip select, you need to set that as the mask for the state of the chip selects when you are doing the transfer. aka, if you want bit 0 asserted you'd want to leave it as 0 is the csmask (0xE, for instance). This was a change made after the first release, due to the fact that this is what the QSPI driver does. I'm not entirely happy that this had to change, but i'm not entirely happy that's how the QSPI was done/the fact that that wasn't obvious when using it as a template.
-Dan
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Problem with DSPI in MOD54415
Can you explain it with an example, I did not understand your previous explanation, sorry.
Regards,
TM
Regards,
TM
Re: Problem with DSPI in MOD54415
Right... Sometimes I speak/write a little densely.
So, your code sets the argument 'peripheralChipSelects' to '0x01', as you want to assert chip select 0 during the transfer. Due to the change in the way that argument is used after 2.6.2, you'll want to change it to the value you want each chip select in during the transfer. If you want the CS high during the transfer, set the bit to one, if you want it low, set it to zero.
Example: your current init call is
Due to the change, you want to change it to
Does that clear things up?
-Dan
So, your code sets the argument 'peripheralChipSelects' to '0x01', as you want to assert chip select 0 during the transfer. Due to the change in the way that argument is used after 2.6.2, you'll want to change it to the value you want each chip select in during the transfer. If you want the CS high during the transfer, set the bit to one, if you want it low, set it to zero.
Example: your current init call is
Code: Select all
DSPIInit(3,2000000,16,0x01,1,1,1,0,0,0);//initializing SPI 3
DSPIInit(1,2000000,16,0x01,1,1,1,0,0,0);//initializing SPI 1
Code: Select all
DSPIInit(3,2000000,16,0xFE,1,1,1,0,0,0);//initializing SPI 3
DSPIInit(1,2000000,16,0xFE,1,1,1,0,0,0);//initializing SPI 1
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Problem with DSPI in MOD54415
Yeah that helps, I will implement this and post the results. Once again thanks for helping.
Update:I uploaded the changes and it seems that I am getting data now, thanks.
Regards,
TM
Update:I uploaded the changes and it seems that I am getting data now, thanks.
Regards,
TM
Re: Problem with DSPI in MOD54415
Hi Dan,
As a follow-up to this topic, can you explain a bit more about the Chip Select. If I have two SPI devices on the same bus, how do I toggle between them using the CS lines? Do I need to re-init the SPI, with a different CS mask, between each read?
Thanks,
Shahrukh
As a follow-up to this topic, can you explain a bit more about the Chip Select. If I have two SPI devices on the same bus, how do I toggle between them using the CS lines? Do I need to re-init the SPI, with a different CS mask, between each read?
Thanks,
Shahrukh