Can't get UART Loopback to work
Context:Coming from an arduino background, I wanted to further develop my MCU skills and also learn how to read datasheets and reference manuals more efficiently, so I got a NUCLEO-F767ZI board and my idea for a first "project" was to loopback UART messages using the HAL and automatically generated code, and then do it all by myself by manipulating registers (to what degree I want to get rid of the HAL and generated code I'm not sure yet). But I can't get it to work even with all those crutches - this means it was a good decision to get this board, my skills definitely need improving.
Question: At first I just read the documentation and tried a polling method but apparently it doesn't work very well, so I thought I would try to do it using interrupts. I created a project and selected my mcu (not board) and setup USART2 and UART4 to be asynchronous, which generated the appropriate code and then I implemented code as I've seen in different examples: Outside the while(1) loop, I initiate interrupt reception on UART4 with:
HAL_UART_Receive_IT(&huart4, &DataRx, 1);and in the while(1) loop I transmit in USART2 with
status = HAL_UART_Transmit(&huart2, &DataTx, 1, 1000);Then outside main I implented what I think is the IRQ handler function:
void HAL_UART_RxCpltCallBack(UART_HandleTypeDef *huart){
HAL_UART_Receive_IT(&huart4, &DataRx, 1);
}I think this part is supposed to reset interrupt reception and also add write data to DataRx, but this function never gets called, and so RxData never gets written to.
On the hardware side I've looked up the pinout of my board in a page in mbed.com dedicated to it and put a jumper wire between USART2_TX and UART4_RX on arduino compatible headers. I've tried other solution but nothing seems to work. Initially I looked at the official board documentation I got from the board page and I cannot find the PA1 and PA2 pins (the ones that show on the .ioc file when I select the UART channels) so I'm a bit confused and don't know where to look for definitive answers. In terms of software I think I'm doing everything correctly but still I wanted to confirm, and on the hardware side could someone please confirm that I'm using the correct pins for the NUCLEO-F767ZI board? And explain where I can find the correct pins in the ST documentation? Thanks!
