PCM052: M4 crashes when accessing SPI3_MCR while kernel 3.13 is running on the A5

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PCM052: M4 crashes when accessing SPI3_MCR while kernel 3.13 is running on the A5

ソリューションへジャンプ
3,403件の閲覧回数
mpfgregory
Contributor III

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.

ラベル(3)
1 解決策
3,055件の閲覧回数
timesyssupport
Senior Contributor II

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

元の投稿で解決策を見る

11 返答(返信)
3,055件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

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

0 件の賞賛
返信
3,055件の閲覧回数
mpfgregory
Contributor III

Not in low power mode, just without the SD-card and thus without a valid boot loader.

0 件の賞賛
返信
3,055件の閲覧回数
timesyssupport
Senior Contributor II

Hello,

If there is not a bootloader present, what is loading and executing the kernel/dtb?

Thanks,

Timesys Support

0 件の賞賛
返信
3,055件の閲覧回数
mpfgregory
Contributor III

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.

0 件の賞賛
返信
3,056件の閲覧回数
timesyssupport
Senior Contributor II

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

3,055件の閲覧回数
mpfgregory
Contributor III

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.

0 件の賞賛
返信
3,055件の閲覧回数
timesyssupport
Senior Contributor II

Hello,

Good to hear that this resolved the issue - I will pass along your suggestion to our Vybrid developers.

Thank you,

Timesys Support

3,055件の閲覧回数
karina_valencia
NXP Apps Support
NXP Apps Support

timesyssupport​ please continue with the follow up.

0 件の賞賛
返信
3,055件の閲覧回数
karina_valencia
NXP Apps Support
NXP Apps Support

mpfgregory​ did you get previous comment?

0 件の賞賛
返信
3,055件の閲覧回数
karina_valencia
NXP Apps Support
NXP Apps Support

alejandrolozano​ please continue with the follow up

0 件の賞賛
返信
3,055件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I wonder if timesyssupport​ can add some comments? The behavior is changed with different kernel versions.

/Alejandro

0 件の賞賛
返信