Is a FlexBus pin changing its configuration during MQX initialization?

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

Is a FlexBus pin changing its configuration during MQX initialization?

跳至解决方案
1,790 次查看
kackle123
Contributor IV

I am using FlexBus on a Kinetis K64 with MQX 4.2.  The FlexBus and external memory work correctly together as a bare-board project.  But when I try our PCB with an MQX project, I noticed something strange: Unless I re-initialize PTC4 to be used as a FlexBus pin within MY main task, FlexBus writes my data in TWO different places in the memory at the same time, the locations being 2048 bytes apart. 

In other words, init_hw.c in the MQX BSP sets up all the pins appropriately for our custom board, but unless I set up PTC4 again (PORTC_PCR4 = PORT_PCR_MUX(5)) at the beginning of my main task, the data gets written twice, in two different spots. 

I tried using the debugger to walk through the BSP's start-up, but it's not behaving for me.  And I tried searching the MQX code for PTC4 accesses but don't see anything obvious.  Does anyone have an idea of what I might check?  If not, I'm thinking of just leaving my PORTC_PCR4 = PORT_PCR_MUX(5) at the top of my code.

标记 (3)
0 项奖励
回复
1 解答
1,692 次查看
kackle123
Contributor IV

The MQX BSP apparently calls the FlexBus setup code (within init_hw.c) BEFORE this default setup code below (found within init_gpio.c).  So this init_gpio.c code breaks the FlexBus setup, forcing me to re-configure the pin in my main task:

/* PTC4 as TX function (Alt.3) + drive strength */
pctl->PCR[4] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;

在原帖中查看解决方案

1 回复
1,693 次查看
kackle123
Contributor IV

The MQX BSP apparently calls the FlexBus setup code (within init_hw.c) BEFORE this default setup code below (found within init_gpio.c).  So this init_gpio.c code breaks the FlexBus setup, forcing me to re-configure the pin in my main task:

/* PTC4 as TX function (Alt.3) + drive strength */
pctl->PCR[4] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;