cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f767zgt6 usart1 and spi4 not working

arhi
Associate III

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

9 REPLIES 9

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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

 

arhi
Associate III

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 :(

>>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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Comment out call to SystemClock_Config()

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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

int main(void)
{
  uint8_t   radiu[14]="Radi USART1\r\n";

  HAL_Init();
  //SystemClock_Config();
  MX_GPIO_Init();
  MX_USART1_UART_Init();

  HAL_StatusTypeDef hal_status;
  while (1)
  {
    hal_status = HAL_UART_Transmit(&huart1, radiu, 13, 500);
    HAL_Delay(50);
  }
}
arhi
Associate III

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 :(


@Tesla DeLorean wrote:

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.


HSE is not the problem, the source is external clock, everything else works ok (spi1, 2, 3, usart2... ) I monitor via SWO everything works ok wrt main part of the clock... maybe something wrt peripheral clock is wrong but the HSE works

USART1 part of the issue is solved (VDDUSB was not connected). SPI4 still returns HAL_TIMEOUT ... SPI3 for e.g. works properly but if I try to use SPI4 any write attempt returns HAL_TIMEOUT.... makes no sense as I do not see what can SPI master wait on as it should work even if nothing is attached so obviously something wrt spi hardware does not work, no clue what but I'm reviewing now pcb in details maybe something seemingly unrelated is related :(