Skip to main content
Visitor II
November 5, 2021
Solved

USART1 for STM32F411CE using HAL

  • November 5, 2021
  • 3 replies
  • 2017 views

Hello! I am trying to get the USART1 (only using as a UART) for the STM32F411CE. I have been doing some studying on the STM32407VG and got the UART to work with straight register manipulation. (That was done here: https://community.st.com/s/question/0D53W000017PE8JSAW/why-does-the-debugger-not-respond-after-ue-bit-is-set-for-uart4)

But I figure I try to learn some HAL now and repeat the same exercises with a STM32 blackpill (STM32F411CE).

Here is my code:

https://github.com/BitBangGaming/Piggy-Pad-Firmware-Workspace/tree/main/N64_Piggy_Pad_Cable/Src

I did look around at some tutorials and I am not sure what I am missing! I am able to enter the main loop but it seems as though my function for transmitting times out and never gets a chance to send out an data.

Here is my wiring as well:

https://github.com/BitBangGaming/Piggy-Pad-Firmware-Workspace/blob/main/N64_Piggy_Pad_Cable/stm32F411CE_blackpill_n64.png

Any hints are greatly appreciated.

Note: The "main" and "comms_n64_console" modules are where you want to look. I tried my best to keep everything as modular as possible (and neat as possible!).

Thanks for reading!

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    Doesn't it have an 8 MHz crystal?

    https://github.com/BitBangGaming/Piggy-Pad-Firmware-Workspace/blob/main/N64_Piggy_Pad_Cable/Inc/stm32f4xx_hal_conf.h#L95

    Nevermind, it doesn't

    https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0.html

    Do you have an stm32f4xx_it.c file with the interrupt handler for the SysTick?

    Could you use a debugger and see where it's stuck perhaps? Or look at the RCC, GPIO and USART peripheral registers?

    3 replies

    Graduate II
    November 5, 2021

    Doesn't it have an 8 MHz crystal?

    https://github.com/BitBangGaming/Piggy-Pad-Firmware-Workspace/blob/main/N64_Piggy_Pad_Cable/Inc/stm32f4xx_hal_conf.h#L95

    Nevermind, it doesn't

    https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0.html

    Do you have an stm32f4xx_it.c file with the interrupt handler for the SysTick?

    Could you use a debugger and see where it's stuck perhaps? Or look at the RCC, GPIO and USART peripheral registers?

    JCorl.1Author
    Visitor II
    November 5, 2021

    Nah no debugger (coming soon). I do have a logic analyzer. Actually let me see if I can even toggle the GPIO on that pin to see if its something weird with my setup.

    JCorl.1Author
    Visitor II
    November 5, 2021

    Welp, my logic analyzer has one of its channels not working correctly. Switched the channel over and it works if now. :expressionless_face:

    Thanks for pointing in me the right direction. I need to remove SysTickHandler, totally forgot it was there.