har-in-air / STM32F411_USB_AUDIO_DAC

USB Hi-Res Stereo Audio DAC using STM32F411 / 401 "Black Pill" development board and Texas Instruments PCM5102A / Philips UDA1334ATS DAC modules
GNU General Public License v3.0
163 stars 31 forks source link

Error in interrupt table for STM32F411 #2

Closed robcazzaro closed 3 years ago

robcazzaro commented 3 years ago

First of all, thanks for sharing this. Really helpful

I ported your code to the Windows version of STM32IDE, and I noticed that every time I pushed the Black Pill KEY button, the code would hang in the following section of startup_stm32f411ceux.s

    .section  .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
  b  Infinite_Loop
  .size  Default_Handler, .-Default_Handler

I fixed the problem by making two changes in stm32f4xx_it.c

from

void EXTI1_IRQHandler(void)
{
  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
}

to

void EXTI0_IRQHandler(void)
{
  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);
}

It looks like at some point, you changed the interrupt you used and the pin to trigger it, so the code was jumping to a non-existent IRQ service routine and trapped in the infinite loop handler

I would also suggest adding the following to the hardware connections, to explain how to generate the debug print in the USART2 output

A2                         TX       Serial debug
A3                         RX
GND                        GND
--------------------------------------------------------------------
To trigger debug printout (if enabled with DEBUG_FEEDBACK_ENDPOINT). press the KEY button on the Black Pill

[Not sure if it repros also with the STM32F401 project, I only compiled for STM32F411, but I think the same would happen for the STM32F401, too]

har-in-air commented 3 years ago

Thanks, fix works on F401CCU6 board.