nucleo-H743zi2 LTDC_IRQHandler()

Working libraries, libraries being ported and related hardware
Post Reply
User avatar
MasterT
Posts: 33
Joined: Mon Apr 20, 2020 12:02 am

nucleo-H743zi2 LTDC_IRQHandler()

Post by MasterT »

I make LTDC running on nucleo-H7, adapted one of the oficial examples for H743-eval.
What I can't understand, is why LTDC_IRQHandler never called.
Steps I done:

Code: Select all

 (example copy /paste:
  // Set LTDC Interrupt to the lowest priority
  HAL_NVIC_SetPriority(LTDC_IRQn, 0xF, 0);   
  HAL_NVIC_EnableIRQ(LTDC_IRQn); 

than:
#ifdef __cplusplus
    extern "C" {
#endif
      
  void LTDC_ER_IRQHandler(void);

  void LTDC_IRQHandler(void);

  void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc);
  void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc);
  void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc);
/*#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID,
                                            pLTDC_CallbackTypeDef pCallback);
*/


#ifdef __cplusplus
    }
#endif

void LTDC_IRQHandler(void)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_SET);  
    HAL_LTDC_IRQHandler(&LtdcHandle);
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_RESET);  
}

void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_SET);  
  ReloadFlag = 1;
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_RESET); 
}
same trics works for void DMA1_Stream2_IRQHandler(void);
just importing as "extern" IRQHandler. But with LTDC I'm running out of ideas, testing with a scope GPIO I see that LTDC_IRQHandler never triggered, same time I know that two bits IE in interrupt register of the LTDC are set and if I push a button (example : LTDC_ColorKeying) everything just hangs up.

I also try to change:
#define USE_HAL_LTDC_REGISTER_CALLBACKS 1U /* LTDC register callback
0 to 1 and back, compiled code size is changed but no defference with LTDC_IRQHandler

.word LTDC_IRQHandler /* LTDC */
is in startup_stm32h743xx.s, so I don't know if it referenced somewhere - directory is "templates"
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: nucleo-H743zi2 LTDC_IRQHandler()

Post by fpiSTM »

You have to add extern "C" before each definition or extend your group.
User avatar
MasterT
Posts: 33
Joined: Mon Apr 20, 2020 12:02 am

Re: nucleo-H743zi2 LTDC_IRQHandler()

Post by MasterT »

Extern C already there, wrap in ifdef tags. I don't understand "extend group". LTDC_IRQHandler must be referenced somewhere, it's not part of the HAL .
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: nucleo-H743zi2 LTDC_IRQHandler()

Post by fpiSTM »

See above. You have to add
extern "C" before each definition. I told group about the #ifdef.

Code: Select all

extern "C" void LTDC_IRQHandler(void)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_SET);  
    HAL_LTDC_IRQHandler(&LtdcHandle);
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_RESET);  
}

extern "C" void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_SET);  
  ReloadFlag = 1;
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0, GPIO_PIN_RESET); 
}

Weak handlers are defined in the startup file, IIWR
User avatar
MasterT
Posts: 33
Joined: Mon Apr 20, 2020 12:02 am

Re: nucleo-H743zi2 LTDC_IRQHandler()

Post by MasterT »

Thanks for reply.
Meanwhile I was diging into example code, and connted out this two line:

Code: Select all

//      while(ReloadFlag == 0) {
  //      }    
It helps me differentiate if uCPU hang up really because of interrupt misconfiguration (seen this millions time with any peripheral)
or while{} stucks for another reason. I trace down bit setting in the (LTDC_SRCR) - bit:2 vertical blanking reload interrupt and (LTDC_IER) - bit:3 RRIE: Register reload interrupt enable. I see that pressing button indeed sets all chain in correct phase, but to my surprise SRCR bit newer resets as vertical blanking never happened. It must. So I rolled back default screen configuration ( my new version is highly optimized to 150 MHz , no porches before-after screen acive area and size was shrink down to 16x64).
And miracle comes, interrupt fired as it should.

So hardware issue, I 'd call it a bug - since blocking bits /interrupt flow because of wrong settings is an illegal action.
Post Reply

Return to “Libraries & Hardware”