base->CTRL = (base->CTRL & ~LPUART_CTRL_M_MASK) | (0 << LPUART_CTRL_M_SHIFT) | (base->CTRL & ~LPUART_CTRL_M7_MASK) | (1 << LPUART_CTRL_M7_SHIFT);
base->BAUD &= ~LPUART_BAUD_M10_MASK;
解決済! 解決策の投稿を見る。
I made some summaries,hope it works for you.
1.7-N-1 9600 No Flow Control ->Set M = 0,M7 = 1,M10 = 0;
2.7-E/O-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 0;
3.8-N-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 0;
4.8-E/O-1 9600 No Flow Control ->Set M = 1,M7 = 0,M10 = 0;
5.9-N-1 9600 No Flow Control ->Set M = 1,M7 = 0,M10 = 0;
6.9-E/O-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 1;
7.10-N-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 1;
Hİ @Senlent Thank you for reply.
I forgot to ask you. What is the proper configuration of lpuart_user_config_t for my situation?(7-E-1 9600 No Flow Control) ?
Sholud I add the LPUART_7_BITS_PER_CHAR line to within lpuart_bit_count_per_char_t enum type(lpuart_driver.h)?
no,this should not work, you can modify it by setting CTRL register.
Hi @Senlent
I changed the driver as you descirebed, send the string "abc" from s32k144 with 100msec delay. I got unreliable data from s32k144.
(It was changing over the time)
(Perceived data from serial convertor(9600-7-E-1 No Flow Control))
When i send the same string from serial convertor , i saw what i send
I search more robust solution for my problem
Will there be such a problem when sending a single character?
My test here is normal, but I didn’t use an oscilloscope to capture whether the configuration is correct.
You can test whether the single-character sending and receiving is normal.
It takes a while to test
Hi @Senlent ,
My configuration
lpuart_user_config_t lpuart0_InitConfig0 = {
.transferType = LPUART_USING_INTERRUPTS,
.baudRate = 9600U,
.parityMode = LPUART_PARITY_EVEN,
.stopBitCount = LPUART_ONE_STOP_BIT,
.bitCountPerChar = LPUART_8_BITS_PER_CHAR,
.rxDMAChannel = 0U,
.txDMAChannel = 0U,
};
and also change the LPUART_SetBitCountPerChar() function as you descirebed
I send a single character ('a')to the serial converter. I received from serial converter
0x61(a) 0x7F(DEL)
I made some summaries,hope it works for you.
1.7-N-1 9600 No Flow Control ->Set M = 0,M7 = 1,M10 = 0;
2.7-E/O-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 0;
3.8-N-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 0;
4.8-E/O-1 9600 No Flow Control ->Set M = 1,M7 = 0,M10 = 0;
5.9-N-1 9600 No Flow Control ->Set M = 1,M7 = 0,M10 = 0;
6.9-E/O-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 1;
7.10-N-1 9600 No Flow Control ->Set M = 0,M7 = 0,M10 = 1;
S32K-RM Chapter:
53.4.5.1 Data Modes
The LPUART transmitter and receiver can be configured to operate in 7-bit data mode by
setting CTRL[M7], 9-bit data mode by setting the CTRL[M] or 10-bit data mode by
setting BAUD[M10].
test.
send char "1" to PC ,"1" ascill ->0x31->0b00110001
PC will received hex 0xb1->0b10110001,bit 7 was set to 1.
this should be correct.