Problem with DSPI in MOD54415

Topics for the Eclipse Environment
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Problem with DSPI in MOD54415

Post by nicobari »

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
User avatar
dciliske
Posts: 623
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Problem with DSPI in MOD54415

Post by dciliske »

Are you connected to the correct SPI module on the MOD5441X? (the default module is set in 'dspi.h')

-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: Problem with DSPI in MOD54415

Post by nicobari »

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
User avatar
dciliske
Posts: 623
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Problem with DSPI in MOD54415

Post by dciliske »

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
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: Problem with DSPI in MOD54415

Post by nicobari »

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: 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 to initialize the DSPI

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 to configure the PINS

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
Regards,
TM
User avatar
dciliske
Posts: 623
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Problem with DSPI in MOD54415

Post by dciliske »

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 Ciliske
Project Engineer
Netburner, Inc
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: Problem with DSPI in MOD54415

Post by nicobari »

Can you explain it with an example, I did not understand your previous explanation, sorry.

Regards,
TM
User avatar
dciliske
Posts: 623
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Problem with DSPI in MOD54415

Post by dciliske »

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

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
Due to the change, you want to change it to

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
Does that clear things up?

-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: Problem with DSPI in MOD54415

Post by nicobari »

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
salavi
Posts: 5
Joined: Fri Mar 28, 2014 6:49 am

Re: Problem with DSPI in MOD54415

Post by salavi »

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
Post Reply