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

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

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

663 Views
m_mollo
Contributor I

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";
};

&rpmsg{
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.

RDC_SEMAPHORE_Lock(rdcPdapGpio3);
GPIO_xxx(...);
RDC_SEMAPHORE_Unlock(rdcPdapGpio3);

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.

Marcelo

Labels (1)
0 Kudos
1 Reply

503 Views
igorpadykov
NXP Employee
NXP Employee

Hi Marcelo

probably  linux still uses some GPIO3, for example :
on i.MX6SX Sabre SD : ov5640, csi_0
linux/arch/arm/boot/dts/imx6sx-sdb.dtsi
imx6sx-sdb.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

on i.MX6SX Sabre AI : SD3 interface
linux/arch/arm/boot/dts/imx6sx-sabreauto.dts
imx6sx-sabreauto.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

rtos gpio example can be found in  ..driver_examples/gpio_imx :
 i.MX 6SoloX FreeRTOS BSP 1.0.0 for Cortex-M4
https://www.nxp.com/webapp/Download?colCode=FREERTOS_MX6SX_1.0.0_WIN&appType=license&location=null
Rpmsg unit test can be found on
rpmsg\test - imx-test - i.MX Driver Test Application Software 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos