5743R/5746R  -SPI slave

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

5743R/5746R  -SPI slave

1,136 Views
zhangxujian
Contributor II

 howiefa43khumphri     

how to configure a DSPI as slave routine using processor export on S32DS?I used oscilloscope to collect external equipment to send data to slave spi on MCU, clock and data are ok, but a receiving interruption of this spi do not happen, what is wrong?My configuration is as follows:

void SPI0_init(void)
{
INT_SYS_InstallHandler(DSPI0_RFDF_IRQn, &DSPI0_Receive_IRQHandler, (isr_t *)0);
DSPI_SlaveInit(INST_DATA_RX_33664SPI,&DATA_RX_33664SPIState,&DATA_RX_33664SPI_SlaveInitConfig0);
DSPI_SlaveTransfer(INST_DATA_RX_33664SPI,DATA_RX_33664SPI_master_send,DATA_RX_33664SPI_master_receive,5);
}
Tags (1)
0 Kudos
5 Replies

914 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

as far as I know the interrupt handler is installed by default and interrupt enabled when DSPI_SlaveInit() is called, so you should not install it again.

Btw, there is demo code within S32 DEsign Studio, which shows the usage of DSPI driver in interrupt based mode. It is called "dspi_master_interrupt_mpc5746r", slave is used as well in this demo.

BR, Petr

914 Views
zhangxujian
Contributor II

By the way, I find that this slave interrupt function (DSPI_RECEIVE_isr(dspi_instance_t instance) )will only be executed once and will never be re-entered. Why?

0 Kudos

914 Views
claudio_b
Contributor II

I have the same problem: the interrupt is callee only once. May be I miss something in the Callback function?

I have the same configuration of zhang xujian: my device is a slave and I want to have an interrupt avery time a byte is received.

Thank you!

0 Kudos

914 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

generally the interrupt callback is used to call user function when interrupt is executed and special event appears. The driver is commonly written in the way it uses peripheral interrupt, however this is hidden for user and not use in driver API at all. Installing such callback, user is aware of the event occurrence and can add a user code which will be executed during interrupt handler.

The name of callback function is set within SPI component inspector. Then you will place a callback function with the same name in code as 

void MySlaveCallback(void *driverState, spi_event_t event, void *userData)
{

   (void)driverState;
   (void)userData;

   

   if(event==SPI_EVENT_END_TRANSFER)
   {
      // you can process slave receive data here
   }

}

note: there is just single event available in the SPI driver and so the callback is called only for end of transfer.

BR, Petr

914 Views
zhangxujian
Contributor II

Hi,Petr,Thank you for taking the time to answer my questions,But this routine seems to be missing the interpretation of the interrupt function.So I still don't know how to use this slave receive interrupt function.

0 Kudos