2023-02-02 11:38 PM
I'm using STM32f103C8T6 Blue pill. for IDE is CUBEIDE and using HAL library
wanna receive data from producted BMS module, then additionally control the mcu by received datas.
BMS communication module setting is 9600 8-Even-1 by 485 communication.
i wanna transmit like unsigned char tx1_tx[6] = {0x02, 0xAA, 0x01, 0xC1, 0x6C, 0x03}
I tested using 485 to USB module then, when I check the terminal, it seems like ok for communicating. actually i got the data what i want
(i attatched jpg file)
the problem is that using the HAL library and setting 9600 8-E-1 for blue pill, such like attached jpg
Tx data seems like weird. Result is here
in hal i write
unsigned char tx1_data[6] = {0x02, 0xaa, 0x01, 0xc1, 0x6c, 0x03};
in side while
HAL_GPIO_WritePin(rs485_GPIO_Port, rs485_Pin, GPIO_PIN_SET);
HAL_UART_Transmit(&huart1, tx1_data, 6, 10);
HAL_Delay(5000);
what should i do for this problem?
Thanks
2023-02-02 11:56 PM
>>what should i do for this problem?
HAL_UART_Transmit(&huart1, tx1_data, sizeof(tx1_data), 100);//for starters
>>485 communication.
485 communication is half duplex, show us what kind of transceiver are you using, did you tested the transceiver alone?(bluepill is 3v3 , is your transceiver cool with that?)
are you getting consistenly the same wrong results?
2023-02-03 12:00 AM
Delay between activating the transceiver and transfer start?
2023-02-03 12:34 AM
Config in 9 bit mode to accommodate the parity bit.
ST includes it in the data payload, ie 8+1