SPI slave mode cannot enter receive interrupt

Hi,

     The chip model I used is RH850-U2A8, I need to complete SPI slave communication, its code is generated by Smart Configurator (because MCAL does not support SPI slave, sad).
After a preliminary look at the generated code, which was fine and the flow followed the instructions in the chip manual, I started testing. When I sent SPI data to MCU from the upper computer, I found that the receiving interrupt could not be entered, and the interrupt flag bit was not set. 

     In order to confirm the connection of SPI, I used MCAL to configure the SPI host and send data to the upper computer. The upper computer could display correct data, which proved that my connection method was OK. To make sure the interrupt is enabled, I check the EIC register,SPI INTMSK register, and the send and receive enable bits, which are all in the correct state.
So I feel very confused and hope to have a direction to solve this problem

   Thanks

   Yin

Parents Reply Children
  • Hi Vasanthrs,

          Thank you very much for your answer. The specific chip model I used is R7F702301-BFABG.First of all, I made sure to enable  and unmask  interrupts, including all interrupts of EIC register, SPI module INTMSK register and CFGm0 register, but when I added "R_A1000A_SPI_Send()" function in the initialization code, everything worked fine.
          At the beginning, the workflow I expect is that the SPI prepares to receive data after the slave is initialized, then parses the data and sends the data back to the host without actually entering the receive interrupt. Then, I tried to send some data after the SPI slave was initialized, after which the communication with the upper computer was normal (when the upper computer sent data to the slave, it could enter a receive interrupt).
           The problem now is that when I integrate the SPI from the machine code into the minimal project (with only the required modules configured), it works fine, and the number of times the send interrupt and receive interrupt enter depends on the Frame count. But when I integrated the SPI from the machine code into the big project (adding the OS module, all interrupts are managed by the OS), the receive interrupts could not come in or could only come in once, not depending on the Frame count.
    Here is my SPI slave configuration:

    This is my initialization code:

    R_A1000A_SPI_Create();
    R_A1000A_SPI_Start();
    R_A1000A_SPI_Recieve(Rxbuf);
    R_A1000A_SPI_Send(Txbuf);
    R_A1000A_SPI_Software_Trigger();