2019-11-08 12:41 AM
Hi Team,
I am using stm32L0 & stm32h7 controller in my design. we can try to communicate from stm32l0(tx) to stm32h7(rx) using UART.
stm32h7 While receiving that data was not correct.
STML0 was UART Polling mode of transmission. In stm32H7 was Interrupt mode receiving data byte by byte.
Here i am mentioned my configuration (stm32H7):-
stm32l0xx_it.c
main.c
UART_HandleTypeDef huart2;
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART2_UART_Init(void);
void buffUpdate(char datar);
char rdata[30];
uint8_t writeindex = 0;
uint8_t readindex = 0;
char recedata[30];
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
__HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE);
while (1)
{
if(readindex!= writeindex)
{
while(readindex!= writeindex){
if(rdata[readindex]!='\r'){
recedata[readindex]=rdata[readindex];
}
else{
}
readindex++;
}
HAL_UART_Transmit(&huart2, &recedata, sizeof recedata,1000);
__HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE);
memset(rdata,0,sizeof rdata);
memset(recedata,0,sizeof recedata);
readindex=0;
writeindex=0;
}
}
}
void buffUpdate(char datar){
rdata[writeindex]=datar;
writeindex++;
}
2019-11-08 01:11 AM
> While receiving that data was not correct.
How not correct?
Have you observed the data using oscilloscope/LA?
JW
2019-11-08 02:24 AM
Hi,
>Have you observed the data using oscilloscope/LA?
I have verified in in external UART Terminal.
thanks,
vel
2019-11-08 02:24 AM
Hi,
>Have you observed the data using oscilloscope/LA?
I have verified in in external UART Terminal.
thanks,
vel