2015-09-17 02:47 PM
I am having no end of difficulty doing even the simplest thing with serial ports.
I am using STM32CubeMX to generate my project which is being compiled by CrossWorks. I try to send a string of text using: HAL_UART_Transmit( &huart3, ( uint8_t * )''TEST\r\n'', 6,0 ); All I get out the serial port is T nothing else ! I also wait for incoming characters using: if ( HAL_UART_Receive( &huart3, buff, 1, 0 ) == HAL_OK ) but despite typing characters into the terminal application this function never returns HAL_OK. So I tried enabling interrupts on UART3 and used: HAL_UART_Transmit_IT( &huart3, ( uint8_t * )''TEST\r\n'', 6 ); Still nothing but if I trace the code through the ISR, it seems to be failing with HAL_BUSY Does anyone have any idea what I am doing wrong ? Andy #free-the-mallocs2015-09-17 05:15 PM
Does anyone have any idea what I am doing wrong ?
We'll be here when you decide it's the HAL2015-09-17 06:11 PM
2015-09-18 02:42 PM
Mark,
Thanks for your help. I tried as you suggested and got ''TEST'' however, if I change the line to HAL_UART_Transmit( &huart3, ( uint8_t * )''TESTING1234\r\n'', 15,200 ); I only get ''TESTING12'' ! Clive, Not sure what your comment is supposed to mean ! Are you suggesting that I am wrong thinking the issue is with the HAL ? Andy2015-09-18 02:48 PM
In further testing, I decided to debug the firmware and see what code was returned from HAL_UART_Transmit and so set a breakpoint on the line following Transmit and it never breaks as it gets a hard fault. The stack trace showed the hard fault occured in
UART_WaitOnFlagUntilTimeout. Andy2015-09-20 12:47 PM
Looks like my issue was stack size now my UART transmit and receive appear to be working :)
2015-10-02 12:52 AM
Hi Andy,
Can you explain the problem about stack size?I seem to have the same issue.Bill