cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to know how can I make the HAL_Delay function work. I configure the System CLock with CubeMX, when I compile the prog there is no errors but my program loops in the HAL_Delay function.

DYann.1
Senior II

How to test only the HAL_Delay (...).

0693W00000Y7VHDQA3.pngThank you for your helps

Regards

12 REPLIES 12
gbm
Lead III

Check the operation of SysTick_Handler() using the debugger. Make sure it fires correctly. If not - check what you did wrong (disabled all interrupts, misconfigured SysTick).

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Karl Yamashita
Lead III

Well if I had to guess, you're probably calling HAL_Delay from an interrupt, which will not work.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
DYann.1
Senior II

Hi,

I don't know if I use with interrupt this function HAL_Delay but It's the summary of my configuration

0693W00000Y7YzIQAV.pngOn the other hand, I can see the SysTick of my configuration is not configured

0693W00000Y7Z01QAF.pngyet my Clock is configured, I probably missed a step. Do you know if I can find information how to activate SysTick ?

0693W00000Y7Z0aQAF.pngI think when you configure when you configure the Clock the SysTic is automatically configured.

Thank you for your advices

Regards

DYann.1
Senior II

Hi,

After some changes, now I think my I2C does not work correctly. In this prototype :

0693W00000Y7aFqQAJ.pngThe HAL_I2C_Master_Transmit return an error, probably for the same reasons. Do you know where I can find examples with I2C ?

Thank you for your helps.

Regards

It could mean that the I2C slave address is invalid or a physical connection issue. You should see what the txResponse value is. Is that where the HAL_Delay is stuck? And why is a 1ms delay needed in that write function?

Also, your write function is a void and you are trying to return HAL_ERROR. The compiler should have gave you a warning about that..

You can find examples in your repository

C:\Users\<user name>\STM32Cube\Repository

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
DYann.1
Senior II

Hi,

Thank you, yes I have a number of error is 1, but what does that mean ? I don't know.

0693W00000Y7aXfQAJ.pngYes I have a warning but I don't know how to return a value. For the hardware (wiring and component address, all is correct). I think it comes from the Clock or SysTick. In fact the I2C need theses parameters.

I'll look at the example you gave me.

Thank you

DYann.1
Senior II

Hi,

After browsing the directory I couldn't find the I2C example with my evaluation board.

0693W00000Y7b7TQAR.pngProbably I have to look elsewhere.

Karl Yamashita
Lead III

You can use the Nucleo example. It is the same Microcontroller.

C:\Users\<suer name>\STM32Cube\Repository\STM32Cube_FW_L5_V1.5.0\Projects\NUCLEO-L552ZE-Q\Examples\I2C

Also, i'm not sure what I2C device you're trying to write to but if it's a 16 bit register then you're not writing the value to your buff array correctly.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
DYann.1
Senior II

Hi,

I can see sevaral example but I don't know which file corresponds to my evaluation card ?

0693W00000Y7gRsQAJ.pngProbably I2C_TwoBoards_ComPolling may suit my needs ?

Thank you