S32K144 spi slave mode CS pin can Independent detect?

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

S32K144 spi slave mode CS pin can Independent detect?

3,183件の閲覧回数
建宽高
Contributor III
0 件の賞賛
返信
6 返答(返信)

2,237件の閲覧回数
razva_tilimpea
NXP Employee
NXP Employee

Hi,

If you want to independently detect in your application the edges of CS you can connect another GPIO configured as input to CS. That pin should be configured to trigger interrupt request.

If you are using SDK and ProcessorExpert you should configure your GPIO like in this picture:

pastedImage_1.png

To install the interrupt request you must call these 2 functions in your application: INT_SYS_InstallHandler();INT_SYS_EnableIRQ();

Best regards,

Razvan

0 件の賞賛
返信

2,237件の閲覧回数
建宽高
Contributor III

HI ,  i have try it as General GPIO ,but  spi_slave_irq can not enter

so , spi slave mode can No CS detection required? that means   spi slave  can not config cs pin ?

0 件の賞賛
返信

2,237件の閲覧回数
razva_tilimpea
NXP Employee
NXP Employee

Ok, now I understand your issue. I suppose that you want to use PCS events for other things.

Can you take a look at the example project provided by SDK? There is an example which shows how to configure spi master and slave. 

The reasons for your problems can be: wrong polarity of the CS, bad handling of interrupt (flags and NVIC) or pins configuration.

Best regards,

Razvan

0 件の賞賛
返信

2,237件の閲覧回数
建宽高
Contributor III

Re-combing the SPI slave problem now encountered

- 1     I am now doing the following configuration for SPI slave

pastedImage_1.png

I use the following spi slave send interface to send a single byte

```

 LPSPI_DRV_SlaveTransfer(USE_SPI_INSATNCE,(const uint8  *)&send,(uint8 *)&rcv,(uint16)1);

```

When my spi master sends a byte of data, the slave can enter the interrupt, as shown below

pastedImage_2.png

- 2   When the chip select is configured as a normal GPIO port

pastedImage_1.png

pastedImage_2.png

I use the following spi slave send interface to send a single byte

```

 LPSPI_DRV_SlaveTransfer(USE_SPI_INSATNCE,(const uint8  *)&send,(uint8 *)&rcv,(uint16)1);

```

When my spi master sends a byte of data, the slave can enter the interrupt transmit error, as shown below

pastedImage_3.png

So I have doubts, can the spi slave CS select pin can be used as normal GPIO for rising edge and falling edge detection, reading SPI slave data?

0 件の賞賛
返信

2,237件の閲覧回数
razva_tilimpea
NXP Employee
NXP Employee

Hi,

The right approach to make LPSPI to work fine is the first one. I have only one suggestion: please set the direction as input for PTB0. 

I have suggested to use another GPIO (not PTB0) if you want to detect rising and falling edges for other purpose than LPSPI data transfers.

If this answer doesn't help you please try to provide details about your usecase to figure out how you should configure SDK drivers.

Razvan

0 件の賞賛
返信

2,237件の閲覧回数
建宽高
Contributor III

HI

I have solved this way. First, PB0 is configured as the CS pin of the hardware, and then when the software is initialized, it is configured as a bilateral edge trigger.

Here is my code

```

PINS_DRV_SetPinIntSel(PORTB, 0, PORT_INT_EITHER_EDGE);
/* Install hander for spi_master_Det ISR */
INT_SYS_InstallHandler(PORTB_IRQn, spi_cs_det, (isr_t *)0);
/* Enable button spi_master_Det IRQ */
INT_SYS_EnableIRQ(PORTB_IRQn);
INT_SYS_SetPriority(PORTB_IRQn, 1);

```

0 件の賞賛
返信