imx8ulp m33 core gpio

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

imx8ulp m33 core gpio

3,071 次查看
tangchao90
Contributor III

my dts configure is:

rpmsg_gpioa: gpio@0 {
compatible = "fsl,imx-rpmsg-gpio";
port_idx = <0>;
gpio-controller;
#gpio-cells = <2>;
#interrupt-cells = <2>;
interrupt-controller;
interrupt-parent = <&rpmsg_gpioa>;
status = "okay";
};

and when the system start , i do the command below

gpioget -c gpiochip0 0

[ 1387.700991] gpio_rpmsg virtio0.rpmsg-io-channel.-1.4: rpmsg not ack 1!
gpioget: unable to request lines: Invalid argument

I sure the gpiochip0 is the gpioa, 

how  can I control the m33 gpio?

标签 (1)
0 项奖励
回复
27 回复数

2,305 次查看
wendy-liu
Contributor II

@Zhiming_Liu 

Hello!我有了一些新的进展,我调用CLOCK_SetIpSrc成功设置了时钟,也读到了kCLOCK_Lpuart2,为0x80000000。但是我在while循环调用LPUART_WriteByte(DEMO_LPUART, 0xaa)接口往串口写数据,调用LPUART_ReadByte(DEMO_LPUART)读数据。却没有读到数据,波形也没测量到。用串口调试助手发数据能接收到,说明硬件是没问题的。我下一步应该往什么方向排查呢?谢谢!附件为我的patch。

0 项奖励
回复

2,301 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello @wendy-liu 

你现在能在串口看到打印信息对吧?原来main函数的收发逻辑无法正常使用吗?demo说明有下注意事项。

The lpuart_polling Example project is to demonstrate usage of the KSDK lpuart driver.
In the example, you can send characters to the console back and they will be printed out onto console
 instantly.
Note: Please input one character at a time. If you input too many characters each time, the receiver may overflow
because the LPUART uses simple polling way for receiving.


不行你就把LPUART2的寄存器 dump出来,然后和LPUART1的比较一下差异吧。

Best Regards,
Zhiming

0 项奖励
回复

2,299 次查看
wendy-liu
Contributor II

是的,我刚打印了,我发现状态寄存器有点问题。发数据的时候TDRE和TC这两位都是0。

0 项奖励
回复

2,296 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

LPUART1的PCC REG是

Zhiming_Liu_0-1745056559976.png

 

你读出来的LPUART2的REG只有第31是1,你把这个寄存器读取放到RESET_PeripheralReset之后再读一次看看?

还有:BOARD_InitDebugConsole中会用到LPUART1的这些宏,你都改成2了吗?

 

/* The UART to use for debug messages. */
#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
#define BOARD_DEBUG_UART_BAUDRATE 115200u
#define BOARD_DEBUG_UART_BASEADDR LPUART1_BASE
#define BOARD_DEBUG_UART_INSTANCE 1U
#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetLpuartClkFreq(BOARD_DEBUG_UART_INSTANCE)
#define BOARD_DEBUG_UART_IP_NAME kCLOCK_Lpuart1
#define BOARD_DEBUG_UART_CLKSRC kCLOCK_Pcc1BusIpSrcSysOscDiv2
#define BOARD_DEBUG_UART_RESET kRESET_Lpuart1
#define BOARD_UART_IRQ LPUART1_IRQn
#define BOARD_UART_IRQ_HANDLER LPUART1_IRQHandler
 
 
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq;

CLOCK_SetIpSrc(BOARD_DEBUG_UART_IP_NAME, BOARD_DEBUG_UART_CLKSRC);
uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ;
RESET_PeripheralReset(BOARD_DEBUG_UART_RESET);

DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
}


Best Regards,
Zhiming

0 项奖励
回复

2,233 次查看
wendy-liu
Contributor II

放到RESET_PeripheralReset之后读出来是0x94000000。

我现在需要同时用到debug串口和LPUART2,所以BOARD_InitDebugConsole里面的宏应该是不用改的吧?

0 项奖励
回复

2,131 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

我现在和你同步了一下进度,可以接收数据。设置参考的你的补丁。

reg = d2000000, 94000000
LPUART_WriteBlocking
get readbuf = 33
get readbuf = 33
get readbuf = 33
get readbuf = 34
get readbuf = 34
get readbuf = 34
get readbuf = 35
get readbuf = 35
get readbuf = 35
get readbuf = 36
get readbuf = 36
get readbuf = 36
get readbuf = 37
get readbuf = 37
get readbuf = 37
get readbuf = 37
get readbuf = 38
get readbuf = 38
get readbuf = 38
get readbuf = 39
get readbuf = 39
get readbuf = 39



Best Regards,
Zhiming

0 项奖励
回复

2,128 次查看
wendy-liu
Contributor II

我一直没有读到数据,是我哪里还没配置好吗?

0 项奖励
回复

2,117 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

这个补丁是基于SDK2.16的,不要使用24.12和25.03,这两个版本下载的SDK有rpmsg的bug。

0 项奖励
回复

2,102 次查看
wendy-liu
Contributor II

我换了SDK2.16,也不行。

打印的日志只有

reg = d2000000, 94000000
LPUART_WriteBlocking

0 项奖励
回复

2,065 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

你的板子是不是哪里有问题?我这里是用的USB转TTY测试的,另外我还测试了eDMA的移植过程,也可以正常用。

0 项奖励
回复

1,908 次查看
wendy-liu
Contributor II

hello!

@Zhiming_Liu ,请问您有测LPUART_WriteByte接口吗?我的串口调试助手一直接收不到数据。

0 项奖励
回复

2,055 次查看
wendy-liu
Contributor II

我知道了!我没把LPUART2接到控制台上,我直接在console的控制台上输入的,所以一直没打印。现在可以用了,谢谢!

0 项奖励
回复

2,433 次查看
wendy-liu
Contributor II

hello! @Zhiming_Liu 

       我刚刚又看了SDK中dsp_examples的sample code,他们的做法是在CM33上初始化DSP及硬件资源,启动DSP core;将实现的代码逻辑放在DSP core,通过MU进行通信。
      我想确认一下,如果想在CM33使用LPUART2,只能通过这种方式吗?还是可以在CM33通过TRDC直接访问外设?

0 项奖励
回复

2,432 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

理论上是可以开放Pbridge2的特定内存区域给指定domain的,控制MBC3即可,开放PCC2和LPUART2的控制权给M33。对应的LPUART2中断号也在M33中定义了。

Zhiming_Liu_0-1744874741068.png

核心问题是时钟,由于这个LPUART2做在了DSP里,必须使能dsp_busclk,至少得加载dsp固件。具体的过程我还没试过。


Best Regards,
Zhiming

0 项奖励
回复

2,426 次查看
wendy-liu
Contributor II

PCC2和LPUART2的MBC权限我也配置了,

/* non secure state can access lpuart2(PBridge2 slot 11, T-MBC3) for eDMA0 */
mbcBlockConfig.memoryAccessControlSelect = TRDC_MBC_ACCESS_CONTROL_POLICY_ALL_INDEX;
mbcBlockConfig.nseEnable = true; /* non secure state can access the block for eDMA0 */
mbcBlockConfig.mbcIdx = 3U; /* MBC3 */
mbcBlockConfig.domainIdx = TRDC_DMA0_DOMAIN_ID; /* MBC3_DOM0 */
mbcBlockConfig.slaveMemoryIdx = 0U; /* MBC3_DOM0_MEM0 */
mbcBlockConfig.memoryBlockIdx = 11U; /* MBC3_DOM0_MEM0_BLK_CFG_W11 */
TRDC_MbcSetMemoryBlockConfig(TRDC, &mbcBlockConfig);

/* non secure state can access PCC2(PBridge2 slot 2, T-MBC3) for eDMA0 */
mbcBlockConfig.memoryAccessControlSelect = TRDC_MBC_ACCESS_CONTROL_POLICY_ALL_INDEX;
mbcBlockConfig.nseEnable = true; /* non secure state can access the block for eDMA0 */
mbcBlockConfig.mbcIdx = 3U; /* MBC3 */
mbcBlockConfig.domainIdx = TRDC_DMA0_DOMAIN_ID; /* MBC3_DOM0 */
mbcBlockConfig.slaveMemoryIdx = 0U; /* MBC3_DOM0_MEM0 */
mbcBlockConfig.memoryBlockIdx = 2U; /* MBC3_DOM0_MEM0_BLK_CFG_W2 */
TRDC_MbcSetMemoryBlockConfig(TRDC, &mbcBlockConfig);

0 项奖励
回复

2,423 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

你这个用的不对TRDC_DMA0_DOMAIN_ID,这两个外设应该给M33 domain:TRDC_M33_DOMAIN_ID

 
另外你可能需要把board.c 1010行的这个段打开:
#if 0
        /* 5. Assign domain ID for m33  */
        trdc_processor_domain_assignment_t domainAssignment;

        TRDC_GetDefaultProcessorDomainAssignment(&domainAssignment);
        domainAssignment.domainId = TRDC_M33_DOMAIN_ID;

        TRDC_SetProcessorDomainAssignment(TRDC, &domainAssignment);
#endif
0 项奖励
回复

2,388 次查看
wendy-liu
Contributor II

我按照你的建议修改了代码,CLOCK_SetIpSrc还是会报错,kCLOCK_Lpuart2的寄存器读出来还是0.

附上我的patch供参考。麻烦帮我再看一下,谢谢!!

0 项奖励
回复

2,427 次查看
wendy-liu
Contributor II

我读了kCLOCK_FusionDspBusClk的频率,通过CLOCK_GetFreq(kCLOCK_FusionDspBusClk),它的频率为96000000。但是依然无法调用CLOCK_SetIpSrc()。麻烦您可以帮我再验证一下吗?谢谢!

0 项奖励
回复

2,515 次查看
wendy-liu
Contributor II

Hello @Zhiming_Liu 

I want to use lpuart polling example on SDK, the demo_example is LPUART1, but I want to use LPUART2.

How to config PCC_REG(kCLOCK_Lpuart2)?I read reg of LPUART1  and LPUART2 CLOCK, result is 0xd2000000 and 0.I guess the system has configured the LPUART clock with default settings.

0 项奖励
回复

2,508 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

Please use other clock as source, then continue debug, you may need to configure trdc  for edma access like LPUART1 in  BOARD_SetTrdcGlobalConfig



Best Regards,
Zhiming

0 项奖励
回复