AnsweredAssumed Answered

i.MX6SoloX - Unexpected behavior of M4 using RPMsg and GPIO

Question asked by Marcelo Mollo on Apr 2, 2019
Latest reply on Apr 2, 2019 by igorpadykov

We are developing an application for the M4, based on the #FreeRTOS_BSP_1.0.1_iMX6SX package, that uses some peripherals exclusively (two UARTs, two CANs, one ECSPI and some GPIOs) and the asymmetric multi processing based on OpenAMP and RPMsg to exchange data with linux.


We have properly modified the device tree "*-m4.dtb" with:


&flexcan1 {
status = "disabled";

&flexcan2 {
status = "disabled";

status = "okay";

&uart2 {
status = "disabled";

&uart3 {
status = "disabled";


etc, etc.


On the hardware_init() of the M4 we have set exclusive access to those peripherals (DOMAIN 1) except for the GPIO which is shared.


#define BOARD_DOMAIN_ID   1


/* first move M4 core to RDC domain 1 */
RDC_SetDomainID(RDC, rdcMdaM4, BOARD_DOMAIN_ID, false);


/* Set UART2 for M4 core domain access only */
RDC_SetPdapAccess(RDC, rdcPdapUart2, 3 << (BOARD_DOMAIN_ID * 2), false, false);


/* Set UART3 for M4 core domain access only */
RDC_SetPdapAccess(RDC, rdcPdapUart3, 3 << (BOARD_DOMAIN_ID * 2), false, false);


etc, etc.


/* In this demo, we need to share board GPIO3 without RDC SEMAPHORE */
RDC_SetPdapAccess(RDC, rdcPdapGpio3, 0xFF, false, false);


We have excluded the whole GPIO3 (I think) in the device tree by means of LCD1:


&lcdif1 {
status = "disabled";


Some GPIOs are used as inputs in interrupt mode.


All the peripherals work correctly, but when we use them together with the RPMsg, the GPIO inputs stop working (interrupts are not triggered any more). All the other peripherals remain working as expected. We have only problems with the GPIO.


I also tried to give exclusive access to the GPIO with the RDC, but a kernel panic is generated.


RDC_SetPdapAccess(RDC, rdcPdapGpio3, 3 << (BOARD_DOMAIN_ID * 2), false, false);


Finally we tried with the semaphore SEM42, but we are still finding problems.




Could anyone give me some indications of how to use GPIO correctly on the M4 in an exclusive way?


It seems that linux overwrites the GPIO registers. Do I have to customize the kernel somehow excluding some features?


Thank you in advance.