Just started with MQX, the K60 and Keil. How do I enable a pin set and use the ALT function to get ot the serial ports? I need 4 of them...

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

Just started with MQX, the K60 and Keil. How do I enable a pin set and use the ALT function to get ot the serial ports? I need 4 of them...

跳至解决方案
771 次查看
brianpaterson
Contributor III

Having just started with the K60, the first thing I found was the disabled pins - such as PTE4 and PTE5.

I need to enable the pins and set the ALT function to the UART. I also require 4 uarts...

I set the user_config.h to enable the TTYx set and ttya: is transmitting correctly.

Any thoughts or demo code I can get a bootstrap from?

Brian

标记 (6)
0 项奖励
1 解答
532 次查看
brianpaterson
Contributor III

Thanks Luis - I'll try it and get back shortly!

A non-obvious spot to set stuff!

Thanks,

Brian

Edit: OK, I see. I also imagine that the I2C and the other buses work in a similar way.

Many thanks for pointing me in the right direction!

Here's another problem, but is associated with the first issue: When I change from one "ALT" function to another. do you have some magic code to illustrate this function? What I'd like to do is save off the initial function and invoke the second, third, etc. and be able to go back and forth between the functions.

Thanks again Luis!

Brian

在原帖中查看解决方案

0 项奖励
2 回复数
532 次查看
LuisCasado
NXP Employee
NXP Employee

Hello,

Go to the file:

C:\Freescale\Freescale_MQX_4_0\mqx\source\bsp\twrk60n512\init_gpio.c

Make the modifications you need in ports (ALT) and rebuild the BSP.

Function:

_mqx_int _bsp_serial_io_init

(

    /* [IN] Serial device number */

    uint_8 dev_num,

    /* [IN] Required functionality */

    uint_8 flags

)

{

    SIM_MemMapPtr   sim = SIM_BASE_PTR;

    PORT_MemMapPtr  pctl;

    /* Setup GPIO for UART devices */

    switch (dev_num)

    {

        case 0:

            pctl = (PORT_MemMapPtr)PORTD_BASE_PTR;

            if (flags & IO_PERIPHERAL_PIN_MUX_ENABLE)

            {

                /* PTD6 as RX function (Alt.3) + drive strength */

                pctl->PCR[6] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;

                /* PTD7 as TX function (Alt.3) + drive strength */

                pctl->PCR[7] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;

……

Luis

0 项奖励
533 次查看
brianpaterson
Contributor III

Thanks Luis - I'll try it and get back shortly!

A non-obvious spot to set stuff!

Thanks,

Brian

Edit: OK, I see. I also imagine that the I2C and the other buses work in a similar way.

Many thanks for pointing me in the right direction!

Here's another problem, but is associated with the first issue: When I change from one "ALT" function to another. do you have some magic code to illustrate this function? What I'd like to do is save off the initial function and invoke the second, third, etc. and be able to go back and forth between the functions.

Thanks again Luis!

Brian

0 项奖励