32-bit SPI framesize problem CW10.2 MQX 3.8

cancel
Showing results for 
Search instead for 
Did you mean: 

32-bit SPI framesize problem CW10.2 MQX 3.8

455 Views
cavebiker
Contributor V

When I set the SPI framesize to 32-bit throught the MQX SPI driver, it gets set to 16-bits. 

 

Here is the code:

param = 32; /* Set framesize to 32 bits for QLX SPI Slave*/
printf("Setting framesize to %d for QLX SPI Slave", param);
if (SPI_OK == ioctl(spi2File, IO_IOCTL_SPI_SET_FRAMESIZE, &param)) {
printf("OK\n");
} else {
    printf("ERROR\n");
}


printf("Getting framesize ... "); /* Get transfer mode */
if (SPI_OK == ioctl(spi2File, IO_IOCTL_SPI_GET_FRAMESIZE, &param)) {
printf("%d\n", param);
} else {
    printf("ERROR\n");
}

 

The result is this: Getting framesize ... 16

It should be 32.

 

Has anyone seen this and is there a work around?

 

Cheers,

Tom

 

0 Kudos
3 Replies

143 Views
drummer
Contributor IV

Is param a 32 bit integer type?

0 Kudos

143 Views
cavebiker
Contributor V

Yes

uint_32 param;

0 Kudos

143 Views
MarkP_
Contributor V

Hi,

The value is set to CTAR FMSZ bits:

  case IO_IOCTL_SPI_SET_FRAMESIZE:

...

    dspi_ptr->CTAR[0] &= (~ (DSPI_CTAR_FMSZ(0x0F)));

    dspi_ptr->CTAR[0] |= DSPI_CTAR_FMSZ(*param_ptr - 1);

 

There are only four bits for the value, so the max. value is 0x0f +1.

~Mark