How to use SSEL1 instead of SSEL0 in SPI8

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to use SSEL1 instead of SSEL0 in SPI8

630件の閲覧回数
waliwalabo
Contributor I

Hi, 

I'm working with LPC55S69 development board and try to use its SPI interface to control a device. 

 

I used FLEXCOMM 8 for this application. And it works fine with ssel0, it's pulled down correctly during the conmmunication.

ThenI was trying to switch to use ssel1 instead of 0 since my next step is driving 3 devices, and it failed. 

 

I didn't use Peripherals in the config tool, since it's not used in the SPI examples provided by the SDK. 

 

What I have tried:

1. changed sselNum in fsl_spi.c

 

2. added 

void SPI3_setSSEL(uint8_t slave) {
    SPI3_InterruptDriverState.handle->masterHandle.sselNum = slave;
}

in fsl_spi_cmsis.c and call it before calling the transfer. I haved changed SPI3 to SPI8.
This method was mentioned in 

SPI: slave select using SDK, e.g., SPI_MasterTransferNonBlocking()?

3. modified spi8_transfer:

static int32_t SPI8_InterruptTransfer(const void *data_out, void *data_in, uint32_t num, uint8_t slave) {

return SPI_InterruptTransfer(data_out, data_in, num, &SPI8_InterruptDriverState); SPI8_InterruptDriverState.handle->masterHandle.sselNum = slave;

}

 

All above 3 didn't work. It's still SSEL0 that was pulled down during the transfering. 

I'm a bignner. And I saw somewhere that to control mutiple device, "Manual Control of CS Lines via GPIO " would work. But it's so confusing that the ssel1-3 was there and I could not use them. 

 

I'm working on the method using GPIO for now, but still want to figure out what the problem with my code that I cannot just switch to SSEL1 from SSEL0 to control only one device. The examples and the documents were not very helpful for me. If you have any working examples, that would be very helpful.

 

Thanks!

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 返信

613件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @waliwalabo 

Please check if your code is configured as follows. There is a thread that describes the steps to configure the SPI chip select signal. However, it's not written in Chinese, so I'll briefly introduce the steps to you. You can also download the code for reference.

 

First, enable the SSEL pins.
1234.jpg
 
Then, enable the slave select register.
 

We can use the SPI_MasterTransferBlocking_ssel function.

This function only adds the chip select value based on the SPI_MasterTransferBlocking function and enables the chip select bit through bitwise operations. The highlighted part shows the changes:
777888.jpg
 
 
BR
Alice
0 件の賞賛
返信