Assigning UART0 Tx

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

Assigning UART0 Tx

Jump to solution
715 Views
Cdn_aye
Senior Contributor I

This sub question is also buried in another thread but so I wanted to ask this as an explicit new question.

I have set the bsp user_config.h file for "ittya:" and as the BSP_DEFAULT_IO_CHANNEL but I need PTA14 ALT3 on the K40dx256 to use UART0 TX0. How do I go about doing that in mqx? I know how to do this outside of mqx using Device Init but I don't see how to select a specific pin within an specific ALT configuration within MQX.

Right now I have mqx running correctly and opening the file block for the UART and using a printf but nothing comes out on the pin. Hence my assumption that the internal configuration is not correct.

Can anyone point me in the right direction please? Thanks

Robert

0 Kudos
1 Solution
477 Views
leslieyang0509
Contributor II

IDE: CW10.3

MQX: 4.0

MCU: K60

Here is my experience for K60

modify _bsp_serial_io_init()

navigation to init_gpio.c

in CodeWarrior Projects window

bsp_twrk60d100m -> twrk60d100m BSP Files -> init_gpio.c

function

/*FUNCTION*-------------------------------------------------------------------

*

* Function Name    : _bsp_serial_io_init

* Returned Value   : MQX_OK for success, -1 for failure

* Comments         :

*    This function performs BSP-specific initialization related to serial

*

*END*----------------------------------------------------------------------*/

_mqx_int __bsp_serial_io_init()

here is the setting of AUX for UART0 (for K60)

     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;

            }

I think it is the same source code file/function for K40

Leslie

View solution in original post

0 Kudos
3 Replies
478 Views
leslieyang0509
Contributor II

IDE: CW10.3

MQX: 4.0

MCU: K60

Here is my experience for K60

modify _bsp_serial_io_init()

navigation to init_gpio.c

in CodeWarrior Projects window

bsp_twrk60d100m -> twrk60d100m BSP Files -> init_gpio.c

function

/*FUNCTION*-------------------------------------------------------------------

*

* Function Name    : _bsp_serial_io_init

* Returned Value   : MQX_OK for success, -1 for failure

* Comments         :

*    This function performs BSP-specific initialization related to serial

*

*END*----------------------------------------------------------------------*/

_mqx_int __bsp_serial_io_init()

here is the setting of AUX for UART0 (for K60)

     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;

            }

I think it is the same source code file/function for K40

Leslie

0 Kudos
477 Views
Cdn_aye
Senior Contributor I

Hi Leslie

What you have suggested makes sense; I could not find any port/bit.uart spcific info on setup. I will give it a try.

Thank you very much for the answer.

Robert

0 Kudos
477 Views
Cdn_aye
Senior Contributor I

Hi Leslie

That was it; works perfectly. Thanks again

Robert

0 Kudos