cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_RECEIVE function not working with Huskylens

AmirImran
Visitor

I want NUCLEO-U083RC board able to receive data from Huskylens for colour/object recognition project. I did manage to run a demo code but still can't receive data from Huskylens. I have use HAL_UART_RECEIVE and HAL_UART_RECEIVE_IT function and still got no output from Huskylens.

Code I'm currently using:

AmirImran_1-1742196122267.pngAmirImran_2-1742196157431.pngAmirImran_3-1742196203640.png

AmirImran_4-1742196228063.png

 

7 REPLIES 7
KDJEM.1
ST Employee

Hello @AmirImran and welcome to the community;

Could you please check the SB45 and SB48 solder bridge.

It is mentioned in UM3256 that you can used USART2 as USART if SB45 and SB48 are ON. By default, these solder bridge are open.  

KDJEM1_1-1742210646449.png

 

KDJEM1_0-1742210513117.png

 

 

Thank you.

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Ozone
Lead III

I strongly suggest to use a scope or logic analyzer, and follow up the path of the supposed UART signal, all the way from your Huskylens device to the Nucleo.
Especially at the source (Huskylens Tx) and the sink (STM32Uxx Rx pin).

This should tell you where to look next.

Welcome to the forum.

Please see How to insert source code - not as images.

 


@AmirImran wrote:

 can't receive data from Huskylens.


Can you receive data from anything else - eg, a PC terminal?

Can you send data to a PC terminal ?

 

As @Ozone said, have you proved that valid data is actually reaching your STM32's UART RX pin?

 

Some serial comms debugging tips here:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/706966/highlight/true#M49

Yes i can, only when i want data from the Huskylens there is no output.

 

Karl Yamashita
Principal

Your code shows you are using USART2 which is typically the VCP port. You have not shown how you've wired the Huskylens to the Nucleo. U(S)ART is push-pull type so you can't have 2 devices, VCP and Huskylens, connected to the same USART of the STM32. 

 

What you should do is use the Nucleo as a gateway to communicate to the Huskylens. Use VCP (USART2) connected to a terminal window like Docklight, and then use USART3 (PC10/PC11) connected to the UART of the Huskylens. So when you receive a message from Huskylens on USART3, you relay the message out to USART2 to the terminal program.

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

I'm using UASRT2(PA2 and PA3) to connect Nucleo board to (Rx and Tx) of Huskylens. I try using other UASRT port (UASRT1 and UASRT3) but cant get any output.

Again, you can't use USART2 as the ST-Link VCP is connected to the same pins. The ST-Link is setting the Tx pin high so you can't have another UART Tx signal try to pull it low, else it will short out the ST-Link's Tx pin.

So instead, use USART3. I've seen several Electrical Engineers in my time, wire UART incorrectly. So just to be sure it's not a hardware issue, show a diagram on how you connect the Huskylens to the Nucleo.  

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.