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.
Solved! Go to Solution.
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
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
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
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.
Ok, now I understand, I was lost. Thanks for everything.