cancel
Showing results for 
Search instead for 
Did you mean: 

UART is Working Fine Independently but not working when SPI is initialized.

Pranoti
Associate II

Hello I am working on Customized board developed using STM32H755ZIT6 microcontroller. I have initialized UART first and it was working fine. Than In the same project I initialized SPI and tested back the UART and now uart is not working I used different pin configuration and Different DMA setting for both but still same problem is there UART is not working. But this code works fine on the NUCLEO H755ZIT6 board

2 REPLIES 2
Aime
ST Employee

Dear @Pranoti ,

 

When UART works initially but stops functioning after SPI initialization on your custom STM32H755ZIT6 board, while the same code works on the NUCLEO board, the issue is likely related to hardware setup or resource conflicts specific to your custom board.
 

Focus on verifying pin assignments, DMA streams, and NVIC settings carefully.

Here is a systematic approach to diagnose and solve the problem:

1. Check Pin Multiplexing and Alternate Function Configuration

Verify that UART and SPI pins on your custom board are correctly assigned and configured as alternate functions without conflict.

STM32H7 MCUs have multiple pins that can serve UART or SPI signals, but some pins may share the same AF number or conflict with each other.

Use STM32CubeMX or the STM32H7 datasheet to confirm:

UART TX/RX pins are assigned to the correct AF mode.

SPI pins (MISO, MOSI, SCK, NSS) are assigned to different pins or AFs that do not conflict with UART pins.

On your custom board, check for any pin remapping or hardware differences compared to the NUCLEO board.

2. Verify Clock Configuration and Peripheral Initialization Order

Confirm that both UART and SPI peripherals are properly clocked and initialized.

Sometimes SPI initialization may alter clock settings or power states affecting UART.

Check your clock tree and peripheral clock enables.

Make sure UART initialization occurs after SPI initialization or vice versa, and that no peripheral de-initialization happens unintentionally.

3. DMA Channel and Stream Conflicts

You mentioned using different DMA settings for UART and SPI, which is good.

However, verify that:

DMA streams and channels assigned to UART and SPI do not overlap or conflict.

DMA priorities are set correctly.

STM32H7 DMA controller has multiple streams; ensure UART and SPI use separate DMA streams and channels.

4. Interrupt Priority and NVIC Configuration

Check that UART and SPI interrupts have appropriate priorities and are enabled.

SPI initialization might change NVIC settings affecting UART interrupts.

Make sure UART interrupt is still enabled and has correct priority after SPI init.

5. Hardware Issues on Custom Board

Compare the schematic and PCB layout of your custom board with the NUCLEO board.

Check for:

Correct pull-up/down resistors on UART and SPI lines.

Signal integrity issues (e.g., long traces, crosstalk).

Proper power supply and grounding for both peripherals.

Use an oscilloscope or logic analyzer to check UART TX line activity.

 

Best regards,
Aime

Hello thanks for your reply. What if that same code of uart and spi combined works fine on NUCLEOH755ZIT-Q board.