SS signal becomes high state every byte on SPI_MasterTransferBlocking API

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

SS signal becomes high state every byte on SPI_MasterTransferBlocking API

跳至解决方案
1,265 次查看
shuichiy
Contributor III

I'm using KSDK2.0 with MDK ARM and MKL17Z256.

In the codes in below, SS signal becomes low at the beginning of transfer correctly, but it becomes high just after the 1st byte has transferred.

I want SS is continuously low state until all bytes has transferred but I cannot find the solution.

 

Do you have any suggestions ?

 

    SPI_MasterGetDefaultConfig(&masterConfig);
    sourceClock = CLOCK_GetFreq(EXAMPLE_SPI_MASTER_SOURCE_CLOCK);
    SPI_MasterInit(EXAMPLE_SPI_MASTER, &masterConfig, sourceClock);

 

   srcBuff[0] = 0x05;          // Instruction
   srcBuff[1] = 0xFF;         // dummy
   xfer.txData = srcBuff;
   xfer.rxData = destBuff;
   xfer.dataSize = 2;
   SPI_MasterTransferBlocking(EXAMPLE_SPI_MASTER, &xfer); 

标签 (1)
0 项奖励
回复
1 解答
1,108 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question, if the SPI is configured as master mode, if you set the MODFEN bit as 1 in SPIx_C2 register, set the SSOE bit as 1 in SPIx_c1 register, the /SS pin will be LOW automatically when the data is transferred. During the interval between two data transfer, the /SS pin becomes HIGH automatically. If you want to leave the /SS pin always LOW even if it is in the interval between two data transfer, you have to use the /SS pin as GPIO output mode, you can set/clear the GPIO as you desired by software.

Pls check if the MODFEN=SSOE=1 in debugger.

Hope it can help you.

BR

Xiangjun Rong

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,109 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question, if the SPI is configured as master mode, if you set the MODFEN bit as 1 in SPIx_C2 register, set the SSOE bit as 1 in SPIx_c1 register, the /SS pin will be LOW automatically when the data is transferred. During the interval between two data transfer, the /SS pin becomes HIGH automatically. If you want to leave the /SS pin always LOW even if it is in the interval between two data transfer, you have to use the /SS pin as GPIO output mode, you can set/clear the GPIO as you desired by software.

Pls check if the MODFEN=SSOE=1 in debugger.

Hope it can help you.

BR

Xiangjun Rong

0 项奖励
回复
1,108 次查看
shuichiy
Contributor III

Since I have seen something continuousSCK option on MK22 SDK, I had expected similar function.

Well, I understand I need to control SS as GPIO separately, thanks.

0 项奖励
回复