The following scenario crashes the Cortex-M4 on my PCM052:
In the MQX BSP 4.0.1 in init_gpio I do:
SPI3_MCR &= ~((0x3 << 28) | (0x1 << 14)); // DSPI to 0x00 & enables module clock
in order to enable SPI3. This works fine if kernel 3.0 is running on the A5 or the A5 is idle. However, if kernel 3.13 is running on the A5, the A4 crashes here. It looks like I can't access the memory mapped register SPI3_MCR (address 0x400AD000u). If I do:
volatile int i = SPI3_MCR;
it also crashes. I have disabled the SPI and SPI_NOR drivers in the kernel. It works fine for SPI0:
SPI0_MCR &= ~((0x3 << 28) | (0x1 << 14));
-> no crash, SPI0 works as expected.
I have no idea which part of the kernel blocks the register access from the M4.
已解决! 转到解答。
Hello,
Perhaps the Linux kernel setting the dspi3 clock gate register could be causing issues - this can be removed/disabled by removing line 228 (clk [VF610_CLK_DSPI3] =...) in build_*/linux-3.13/arch/arm/mach-imx/clk-vf610.c; if you're building using Timesys Factory, you can then issue: make kernel-restage && make to rebuild the kernel. Boot with that change and see if the behavior is different.
Thank you,
Timesys Support
Hi,
When the A5 is Idle you mean that is in a low power mode? Or before running Linux?
timesyssupport, Do you know which part of the kernel has to be modified?
Best Regards,
Alejandro
There is the standard u-boot that loads the kernel and dtb. The Linux itself runs fine. But if I load a program to the M4, either by mqxboot or by connecting via USB (CMSIS-DAP) and I access address 0x400AD000u from the M4, the M4 crashes, while the Linux on the A5 continues to run normally. This does not happen with kernel 3.0.
Hello,
Perhaps the Linux kernel setting the dspi3 clock gate register could be causing issues - this can be removed/disabled by removing line 228 (clk [VF610_CLK_DSPI3] =...) in build_*/linux-3.13/arch/arm/mach-imx/clk-vf610.c; if you're building using Timesys Factory, you can then issue: make kernel-restage && make to rebuild the kernel. Boot with that change and see if the behavior is different.
Thank you,
Timesys Support
This fixed it. Thanks a lot!
When developing the Linux BSP please keep in mind that all peripherals might also be used by the M4. When I disable a peripheral in the kernel config I expect its registers to stay untouched. You already did it for SPI0:
if (of_property_read_bool(np, "vf610-dspi0")) | |
clk[VF610_CLK_DSPI0] = imx_clk_gate2("dspi0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(12)); |
I think it makes sense to do it similarly for the other peripherals.
timesyssupport please continue with the follow up.
mpfgregory did you get previous comment?
alejandrolozano please continue with the follow up
Hi,
I wonder if timesyssupport can add some comments? The behavior is changed with different kernel versions.
/Alejandro