Is a FlexBus pin changing its configuration during MQX initialization?

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

Is a FlexBus pin changing its configuration during MQX initialization?

Jump to solution
1,084 Views
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.

Tags (3)
0 Kudos
1 Solution
986 Views
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;

View solution in original post

1 Reply
987 Views
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;