MQX code difference between Kinetis K60 and K20 MCU

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

MQX code difference between Kinetis K60 and K20 MCU

Contributor II


     We need to develop a custom board with K20 MCU. For this we have developed our code using TWR K60 board.

Can i use the same code developed for TWR K60  directly in the K20 board. We could able to download "Hello' example project in the K60 board.

in K20 board. Is there any other changes will be required. We are getting the external interrupts also.

Thanks & Regards


0 Kudos
3 Replies

NXP Employee
NXP Employee

Hello Kiran,

First, I understand your K20 will be 100Mhz like the TWR-K60.

Second, you should clone the TWR-K60 BSP, paying attention to the silicon version of K20 will use. Rev1.x use TWR-K60N512 BSP, for K20 Rev2.x silicon, use TWR-K60D100 BSP.

After cloning, you have to remove the code associated to the peripherals in the K60 BSP that you don't have in the K20, for example Ethernet code.

Then, you will be able to run your MQX applications. Otherwise, you will get hardware faults when the code try to init the peripherals that don't exist in the K20.

And of course, adapt the init_bsp.c, init_hw.c, init_gpio.c to your board and K20 peripherals.

Best Regards,

Contributor II

Hello Luis,

Thank you for your response.

We are facing an issue in the i2c interface with our MCU ( K20 ) in our custom board.

We have changed the i/o settings from Port pin for i2c0 ( PTD8 and PTD9 in TWR-K60 ) to PTB0 and PTB1 to suit our custom board.

For this we have edited init_gpio.c file to

            pctl = (PORT_MemMapPtr)PORTB_BASE_PTR;

            pctl->PCR[0] = PORT_PCR_MUX(ALT2) | PORT_PCR_ODE_MASK;

            pctl->PCR[1] = PORT_PCR_MUX(ALT2) | PORT_PCR_ODE_MASK;

            sim->SCGC4 |= SIM_SCGC4_I2C0_MASK.

But we are not able to communicate with the device. Is there any other settings required?

The SCK and SDA lines are always set to high.

While running the MQX code it hangs in the i2c_pol_ki2c.c file ,

while (0 == (i2c_ptr->S & I2C_S_IICIF_MASK))

{ };   /* wait for address transferred */

We have connected 3 slave devices in the same i2c0 line.

Please help us to resolve this issue.

Thanks & Regards,


0 Kudos

NXP Employee
NXP Employee

Hi Kiran,

Attached are two very good PDF's to help explain porting the BSP from super set RTOS.  They will be in the MQX4.1 release late this month is schedule holds.

Please review and let us know if this resolved your issue.  They cover the details quite well of which one may have been missed causing you your issue.  Sorry.