SPI2 CS MQX3.7 question

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SPI2 CS MQX3.7 question

跳至解决方案
1,598 次查看
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 项奖励
回复
1 解答
1,174 次查看
PetrM
Senior Contributor I

Hello,

 

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

 

Regards,

PetrM

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,174 次查看
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 项奖励
回复
1,174 次查看
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 项奖励
回复
1,175 次查看
PetrM
Senior Contributor I

Hello,

 

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

 

Regards,

PetrM

 

0 项奖励
回复