How can I set the CS signal for spi with _io_ctl()?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I set the CS signal for spi with _io_ctl()?

515 Views
projektecarus
Contributor II

Hi everybody,

I'm using a K60F120M Tower with MQX 4.0.2. I tried to set the CS signal for spi2 to SPI2_CS0/1 with the _io_ctl()-command.

The code looks like this:

...

MQX_FILE_PTR mcp23s17_SPI;

uint_32 mcp23s17_CS = SPI_PUSHR_PCS(1 << 0);     // Chip-Select-Mask for SPI2_CS0

mcp23s17_SPI = _io_fopen("spi2:", NULL);

_io_ioctl(mcp23s17_SPI, IO_IOCTL_SPI_SET_CS, &mcp23s17_CS);

...

_io_write(mcp23s17_SPI,...);

_io_fflush(mcp23s17_SPI);

...

The BSPCFG_ENABLE_SPI2 is set in user_config.h and the return value of _io_fopen isn't NULL. The return value of _io_ctl() is SPI_OK.

If I measure the CS-signal it is always on high, although the MOSI and the CLK signals are OK.

If I don't try to change the standard settings the CS signal works.

Thanks for any help on this problem.

0 Kudos
1 Reply

338 Views
soledad
NXP Employee
NXP Employee

Hi,

The Kinetis SPI driver was updatedto use the eDMA driver.

You need to pass the details using command IO_IOCTL_SPI_SET_CS_CALLBACK.

For more information, please check the MQXIOUG (chapter 9) that you can find at the next path:

C:\Freescale\Freescale_MQX_4_0\doc\mqx

Regards

Sol

0 Kudos