Pin Definition mk60n512

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

Pin Definition mk60n512

跳至解决方案
1,289 次查看
feraro
Contributor IV

Hello.


I'm working with TWR K60N512, CW10.2 and MQX3.7. I need to use a pin as digital input and need to know if the MQX RTOS has configured for some other use. How I can tell?
Thank you.

0 项奖励
回复
1 解答
1,113 次查看
c0170
Senior Contributor III

Hello Fernando Ramon,

you are using K60, thus I would look for PCR register in the BSP folder and this search will return those which are set by default.

For instance from _bsp_serial_io_init, if your application initializes UART0

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

Regards,

MartinK

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,113 次查看
Teckna
Contributor V

Hi Fernando,

in _bsp_gpio_io_init() function before enable clock to all ports you add:

  /****** Set PTD6 as input ********/

  PORTD_PCR6=(0|PORT_PCR_MUX(1)); 

  //Change PTD6 to input

  GPIOD_PDDR&=~ GPIO_PDDR_PDD(0x40); 

  /****** Set PTC1 as input ********/

  PORTC_PCR1=(0|PORT_PCR_MUX(1)); 

  //Change PTC1 to input

  GPIOC_PDDR&=~ GPIO_PDDR_PDD(0x1);

Regards

0 项奖励
回复
1,114 次查看
c0170
Senior Contributor III

Hello Fernando Ramon,

you are using K60, thus I would look for PCR register in the BSP folder and this search will return those which are set by default.

For instance from _bsp_serial_io_init, if your application initializes UART0

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

Regards,

MartinK

0 项奖励
回复
1,113 次查看
feraro
Contributor IV

Hello Kojto. Thanks for your answer.
I have a specific case. I am using the pins: Pin number 6 of PORTD and PORTC pin 1 as digital inputs.

In twrk60n512.h initialize:

# define BSP_PASO_CERO (GPIO_PORT_D | GPIO_PIN6)
# define BSP_11HC08 (GPIO_PORT_C | GPIO_PIN1)

In my code, initialize

input_setC_1 uint_32 const [] = {
BSP_PASO_CERO | GPIO_PIN_IRQ_FALLING,
GPIO_LIST_END
};

input_setC_2 uint_32 const [] = {
BSP_11HC08,
GPIO_LIST_END
};

and see that input_setC_1[0]
bits are different from input_setC_2 [0]. In input_setC_1[0] = 0x81000066 and input_setC_2[0] = 0x80000041. Where are initialized bytes 1 and 0 (0x66 / 0x41)?


Thanks.

0 项奖励
回复
1,113 次查看
feraro
Contributor IV

Ok, now I understand, I was lost. Thanks for everything.


0 项奖励
回复