cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
608 Views
Registered: ‎09-16-2019

XSpiPs_PolledTransfer won't transmit more than 8 bits accurately

Jump to solution

Hello, 

I am trying to use the PS SPI_1 to transmit a series of 24 bit command words. When I try to send a command word, the SPI transmits a 24 bit value but it's nothing close to what I'm trying to send. I'm not sure where it is getting these values from. If I send an 8 bit word everything works fine. 

I can't post the entire code but the code dealing with the PS SPI is as follows:

#define SPI_MIO XPAR_XSPIPS_0_DEVICE_ID
static XSpiPs SpiInstance_MIO;

XSpiPs_Config *SpiConfig_MIO;
SpiConfig_MIO = XSpiPs_LookupConfig((u16)SPI_MIO);
Status = XSpiPs_CfgInitialize(&SpiInstance_MIO, SpiConfig_MIO,SpiConfig_MIO->BaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;}

XSpiPs_SetOptions(&SpiInstance_MIO, XSPIPS_MASTER_OPTION);
XSpiPs_SetClkPrescaler(&SpiInstance_MIO, XSPIPS_CLK_PRESCALE_128);

u32 op_buff[1] = {0x83DF01};

while(1)
{
XSpiPs_PolledTransfer(&SpiInstance_MIO, op_buff, NULL, 3);
}



I haven't used C in a long time so maybe I'm doing something stupid but if anyone can help me out I would appreciate it. Alternatively, I tried using XSpiPS_Transfer but that doesn't function at all. 

 

Thank you for your time. 

0 Kudos
1 Solution

Accepted Solutions
540 Views
Registered: ‎09-16-2019

Ok, I figured out the problem. It's not my code. For whatever reason, the XSpiPs_PolledTransfer() function swaps my 1st and 3rd bytes of the 3 byte value I'm trying to transmit. I had to test all 24 bits individually to figure that out. So I guess I'll just manually swap those bytes. Very strange behavior. 

View solution in original post

0 Kudos
1 Reply
541 Views
Registered: ‎09-16-2019

Ok, I figured out the problem. It's not my code. For whatever reason, the XSpiPs_PolledTransfer() function swaps my 1st and 3rd bytes of the 3 byte value I'm trying to transmit. I had to test all 24 bits individually to figure that out. So I guess I'll just manually swap those bytes. Very strange behavior. 

View solution in original post

0 Kudos