SPI2 CS MQX3.7 question

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

SPI2 CS MQX3.7 question

Jump to solution
867 Views
Belen
Contributor I

Does anybody know how I can set SPI CS1 (PTD15 for Kinetis K60)?

 

I am using IO_IOCTL_SPI_SET_CS but I don't know the correct value for the param.

 

Thank you,

Belén.

0 Kudos
1 Solution
443 Views
PetrM
Senior Contributor I

Hello,

 

to deassert CS simply call fflush (spi_fd) or IO_IOCTL_FLUSH_OUTPUT command.

 

Regards,

PetrM

 

View solution in original post

0 Kudos
3 Replies
443 Views
PetrM
Senior Contributor I

Hello, this should do it:

 

param = SPI_PUSHR_PCS(1 << 1);

ioctl (spi_fd, IO_IOCTL_SPI_SET_CS, &param);

 

The parameter type of this IOCTL command always corresponds to the one in the BSP SPI init structure (init_spi.c).

 

Regards,

PetrM

0 Kudos
443 Views
Belen
Contributor I

Thank you very much.

 

It works but my problem now is that I can't unset CS. I tried with:

 

        param = SPI_PUSHR_PCS(1 << 1);
        ioctl (spifd, IO_IOCTL_SPI_FLUSH_DEASSERT_CS, &param);

 

but it doesn't work. Any suggestions?

 

Regards,

Belén.

 

 

0 Kudos
444 Views
PetrM
Senior Contributor I

Hello,

 

to deassert CS simply call fflush (spi_fd) or IO_IOCTL_FLUSH_OUTPUT command.

 

Regards,

PetrM

 

0 Kudos