FSP returning error when configuring r_spi for 4-wire SPI Master on RA2A1

Hello Support Team,

I want to use the SPI peripheral module of EK-RA2A1 as a master device to communicate with a Battery Front End. The protocol requires to drive SSL pin in the following way:

So that I need Single Master SPI operation with r_spi stack element in FSP.

I have the following settings: Master, SPI Operation, Full Duplex.

I have also enabled the SPI configuration parameters checking!

After calling the err = R_SPI_Open(&g_spi0_ctrl, &g_spi0_cfg); initialization function, the returned error code is FSP_ERR_UNSUPPORTED. It is originating from these lines of the function's body in r_spi.c:

if ((SPI_MODE_MASTER == p_cfg->operating_mode))
/* 4-Wire Mode is not supported in master mode on devices without SSL_LEVEL_KEEP */

If configuration parameters checking is disabled then no error is returned and the SPI works fine. According to RA2A1 User's Manual the MCU is supporting Master mode with SPI Operation to drive the SSL pin but FSP is returning an error.

Could help me with that?

Thank you!

  • Hi Orlin,

    Thanks for your question on Engineering Community. 

    The error occurs because you have selected SPI Operation instead of Clock Synchronous Operation as SPI Mode. Clock synchronous operation is 3-wire mode and does not use any SSL pin. The operation of the module is the same as in SPI Operation, except that mode fault errors are not detected because the SSL pin is not used.

    Alternatively you can try keeping SPI Operation mode and disabling parameter checking. Please note that most FSP APIs can only return FSP_SUCCESS if parameter checking is disabled.

    Best regards,