2021-02-11 07:25 AM
I got the example files from here:
You are missing the famous set of examples for UART with DMA by Tilen Majerle.
https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx
I selected the project usart_dma_rx_idle_line_irq_F4.
First thing I notice, it did not have a .ioc file for me to configure the rest of the chip.
I do not know how to fix this. It is for a generic F4. I have a Nucleo-F446RE.
Is the missing .ioc the cause of the error:
arm-none-eabi-objcopy.exe -O ihex "usart_dma_rx_idle_line_irq_F4.elf" "usart_dma_rx_idle_line_irq_F4.hex"
/bin/sh: 1: arm-none-eabi-objcopy.exe: not found
make[1]: *** [makefile:84: post-build] Error 127
make: *** [makefile:52: all] Error 2
"make -j12 all" terminated with exit code 2. Build might be incomplete.
2021-02-11 06:39 PM
I scrwed up the file, and decided it was best to re-download the project.
I looked over the projects and wanted to have an example with transmit DMA. The Documentation said:
Examples for RX & TX
Unfortunately there were no examples that started with usart_tx. There were only usart_rx.
I wanted to see if I could get something to work. Since I have a Nucleo-F446RE there were only 2 choices.
usart_rx_idle_line_irq_F4
usart_rx_idle_line_irq_rtos_F4
And since I did not want RTOS I went with usart_rx_idle_line_irq_F4
I used File->Open Projects from File System, and pointed into that directory (/home/kip/STM32CubeIDE/stm32-usart-uart-dma-rx-tx-master/projects/usart_rx_idle_line_irq_rtos_F4)
Deleted the post build command with arm-none-eabi-objcopy.exe program. I have searched the whole computer and did not find the file. )
Compiled Project with no errors or warnings.
I put my FTDI TTL-232R-3V3-WE cable on the USART3 TX and RX and Gnd. Set up the moserial program to look at the the /dev/ttyUSB0 and set it at 115200 Baud 8-N-1 No handshake.
And started in the debugger. It appears it went directly to HardFault_Handler(void) in the stm32f4xx_it.c file. And then stayed in the empty while(1) loop.
Maybe the program does not like the debugger.
So I ran it. Since I have never just ran a program not sure how it is supposed to go but it said
Download verified successfully
Debugger connection lost.
Shutting down...
Which I am guessing is correct.
And nothing happens. I tried typing something to see if it echoed back. Nothing.
So I am guessing something is wrong an it is in the same Hard_Fault_Handler() it went to in the Debugger.
What should I do next?
2021-02-11 06:49 PM
By the way I know my serial ports are working because I have another program that does a simple polling write to each serial port
/* USER CODE BEGIN 0 */
uint8_t data1[] = {"11111111111111111111111111111111111111111111111111111111111111\r\n"};
uint8_t data2[] = {"22222222222222222222222222222222222222222222222222222222222222\r\n"};
uint8_t data3[] = {"33333333333333333333333333333333333333333333333333333333333333\r\n"};
uint8_t data4[] = {"44444444444444444444444444444444444444444444444444444444444444\r\n"};
uint8_t data5[] = {"55555555555555555555555555555555555555555555555555555555555555\r\n"};
uint8_t data6[] = {"66666666666666666666666666666666666666666666666666666666666666\r\n"};
/* USER CODE END 0 */
And then farther down it has
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Transmit(&huart1, data1, sizeof(data1), 1000);
HAL_UART_Transmit(&huart2, data2, sizeof(data2), 1000);
HAL_UART_Transmit(&huart3, data3, sizeof(data3), 1000);
HAL_UART_Transmit(&huart4, data4, sizeof(data4), 1000);
HAL_UART_Transmit(&huart5, data5, sizeof(data5), 1000);
HAL_UART_Transmit(&huart6, data6, sizeof(data6), 1000);
HAL_Delay(250);
}
/* USER CODE END 3 */
And that works on all the ports except USART2. I now have had 2 boards where USART2 does not work. the other 5 do. But that is another issue.