Skip to main content
Explorer
November 16, 2023
Question

stm32f767zgt6 usart1 and spi4 not working

  • November 16, 2023
  • 3 replies
  • 2073 views

I have issues getting usart1 and spi4 to work..

USART1 "supposedly" work (software side do not complain) but USART1_TX pin is dead, there is nothing exiting this pin, scope shows it is dead. Same on multiple stm32f767zgt6 chips so it is not a dead chip. No clue if I missed something but USART2 works without a problem for e.g.....

With SPI4 I have other problem, sendreceive times out, I don't get how a MASTER SPI can timeout, it does not wait on anything... but it times out... no matter what I try, it always times out .. spi1/2/3 work ok

STM32CubeIDE is what I'm using to configure and program

    This topic has been closed for replies.

    3 replies

    Graduate II
    November 16, 2023

    Check the clocks for the respective peripherals and GPIO banks.

    Dump some of the registers configuring the pins and peripherals.

    Review the code outputting the data.

    Review the pins and schematic. Make sure you're referring to the correct pin, ideally at the point it exits the chips, but otherwise following the wire to a connector or place you can probe it effectively.

    For ST boards double check Solder Bridged (SB) or similar 0-Ohm resistor options, confirm the current configuration gets a signal to the header in question. Perhaps map as a GPIO and toggle that.

    Work through the logic, make it as simple as possible, check your expectations.

    Make sure it's not falling into an Error or Fault Handler before it gets to the code that outputs.

    arhiAuthor
    Explorer
    November 16, 2023

    that is some common practice I went through few times, pcb is blank, I cut traces just after the mcu and attached scope to them, a friend with similar board did exactly the same, has exactly the same result with my code...

    setup is made by stm32cubeide

    3BE629D9-276A-4D06-BC5A-CEB03FD9FF01.jpeg

    this is usart1 .. I set neighboring pins to input to not make a mess if I touch them with probe by accident or short to TX/RX but that's all ..

    tried different clock config. even lowered periphery clock a lot to test, nothing changed.. and as I said usart2 for e.g. works ok

    D1672504-F79A-41A3-BA34-35DB839F16F5.jpeg

    code is simple

    MX_USART1_UART_Init();

    uint8_t radiu[14]="Radi USART1\r\n";

    while (1) HAL_UART_Transmit(&huart1, radiu, 13, 500);

     

     

    WRT SPI4 it is similar, only while this HAL_UART_Transmit goes without a problem HAL_SPI_TransmitReceive fails with HAL_TIMEOUT

     

    arhiAuthor
    Explorer
    November 16, 2023

    never before I used STM32F7 and I have to admit I DID NOT read full datasheet so I probbly missed something (like you cannot use usart1 if you xyz or if you xyz SPI4 cannot be enabled or something like this) but usually when something won't work cube used to warn or do not allow configuration, I see no issues here in cube but ... I also did not find by quick search through datasheet nothing preventing usart1 from just working :(

    Graduate II
    November 16, 2023

    >>setup is made by stm32cubeide

    Then maybe it's something about your board, but I'm a savant not a mind-reader or remote-viewer.

    All the peripherals on the STM32F7 can operate independently, the conflicts come as to what pins/functions you can escape via the AF Muxing fabric. Each pins can connect to a single peripheral at a time, some pins aren't bonded out of the packages.

    >>code is simple

    That is perhaps simple, the magic happens elsewhere, and that needs to be correct.

    My money is on the HSE doesn't start and you're in some while(1) loop or Error_Handler(), use the debugger and find out.

    Otherwise perhaps HSE_VALUE wrong, or VCAP capacitors missing.

    Graduate II
    November 16, 2023

    Comment out call to SystemClock_Config()

    arhiAuthor
    Explorer
    November 16, 2023

    Interesting idea, tried, nothing changed, nothing exiting usart1_tx pin :(

    arhiAuthor
    Explorer
    November 23, 2023

    UPDATE

    USART1 part is solved, 5th inspection of the schematic and board and I found that VDDUSB was not powered (the guy that designed the board assumed he do not need to power it as USB is not used but did not check that some pins, including USART1 pins, use that as power source). This was fixed (patch wire adding power to VDDUSB and small cap directly on pin) and USART1 works like a charm :)


    SPI4 problem still remains :(

    Doing more checks but I can't seem to figure out what's wrong here. HAL_Write... to SPI4 fails with HAL_TIMEOUT. INIT goes properly but any attempt to write anything however I change the configuration ends up same - HAL_TIMEOUT for every write :(