We use
1. MKL02Z32;
2. Kinetis Design Studio V: 3.2.0;
3. PE
In PE, We use the component AsynchroSerial for UART0.
In Component Inspector.
1. set "ADC0_SE4/PTB2/IRQ_7/UART0_RX/UART0_TX" for RX of the UART0.
2. Set "ADC0_SE5/CMP0_IN3/PTB1/IRQ_6/UART0_TX/UART0_RX" for the TX of the UART0.
After Click "Generate Processor Expert Code", the tool will generate code auto.
But the uart can no work .
In function ASerialLdd1_Init(),
PORTB_PCR2 = (uint32_t)((PORTB_PCR2 & (uint32_t)~(uint32_t)(
PORT_PCR_ISF_MASK |
PORT_PCR_MUX(0x05)
)) | (uint32_t)(
PORT_PCR_MUX(0x02)
));
/* PORTB_PCR1: ISF=0,MUX=2 */
PORTB_PCR1 = (uint32_t)((PORTB_PCR1 & (uint32_t)~(uint32_t)(
PORT_PCR_ISF_MASK |
PORT_PCR_MUX(0x05)
)) | (uint32_t)(
PORT_PCR_MUX(0x02)
));
When i change the PORT_PCR_MUX(0x02) to PORT_PCR_MUX(0x03), then the UART can work fine.
Use PE, how to set the MUX of uart port to 3???
Thanks.
Solved! Go to Solution.
Hello,
according to the KL02 sub-family reference manual the routing is correct. For selection of the Alt3 functionality of these pins you must select PTB2 pin as the TX and PTB1 as the RX, see the following table from the reference manual:
Best Regards,
Marek Neuzil
还在审批?
没人看到吗