Skip to main content
Visitor II
December 13, 2019
Solved

NUCLEO-NFC06A1

  • December 13, 2019
  • 4 replies
  • 1109 views

Good day.

I use devboard NFC06A1 with Nucleo-L053R8. Project from STM32CubeExpansion_NFC6_V1.0.0.

All works fine - via SPI. But when i choose i2C - i have a problem

  1. I changed resistorto select i2c
  2. add pull up resistor R116 and R117
  3. Add define RFAL_USE_I2C

4. change  //HAL_NVIC_SetPriority(I2C1_EV_IRQn, 5, 5);

 //HAL_NVIC_EnableIRQ(I2C1_EV_IRQn);

HAL_NVIC_SetPriority(I2C1_IRQn, 0, 1);

  HAL_NVIC_EnableIRQ(I2C1_IRQn);

Device was crash when call  I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT); in stm32l0xx_hal_i2c.c

MCU freez in startup_stm32l053xx.s

I2C1_IRQHandler
I2C2_IRQHandler
SPI1_IRQHandler
SPI2_IRQHandler
USART1_IRQHandler
USART2_IRQHandler
RNG_LPUART1_IRQHandler
LCD_IRQHandler
USB_IRQHandler
 
 B . ;crash in current line
 
 ENDP
 
 ALIGN

What a mistake here ?

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    on my side, I've used I2C communication between X-NUCLEO_NFC06A1 and NUCLEO-L476RG. For your case with NUCELO-L053R8, it seems that the I2C1_IRQHandler is missing so the default one is used (basically infinitely looping).

    I will check internally but something like the following lines should be added in the stm32l0xx_it.c interrupt handler file:

    /**
     * @brief This function handles I2C1 event global interrupt / I2C1 wake-up interrupt through EXTI line 23.
     */
    void I2C1_IRQHandler(void)
    {
     /* USER CODE BEGIN I2C1_IRQn 0 */
     
     /* USER CODE END I2C1_IRQn 0 */
     if (hi2c1.Instance->ISR & (I2C_FLAG_BERR | I2C_FLAG_ARLO | I2C_FLAG_OVR)) {
     BSP_I2C1_ER_IRQHandler();
     } else {
     BSP_I2C1_EV_IRQHandler();
     }
     /* USER CODE BEGIN I2C1_IRQn 1 */
     
     /* USER CODE END I2C1_IRQn 1 */
    }

    Rgds

    BT

    4 replies

    Technical Moderator
    December 13, 2019

    Hi,

    on my side, I've used I2C communication between X-NUCLEO_NFC06A1 and NUCLEO-L476RG. For your case with NUCELO-L053R8, it seems that the I2C1_IRQHandler is missing so the default one is used (basically infinitely looping).

    I will check internally but something like the following lines should be added in the stm32l0xx_it.c interrupt handler file:

    /**
     * @brief This function handles I2C1 event global interrupt / I2C1 wake-up interrupt through EXTI line 23.
     */
    void I2C1_IRQHandler(void)
    {
     /* USER CODE BEGIN I2C1_IRQn 0 */
     
     /* USER CODE END I2C1_IRQn 0 */
     if (hi2c1.Instance->ISR & (I2C_FLAG_BERR | I2C_FLAG_ARLO | I2C_FLAG_OVR)) {
     BSP_I2C1_ER_IRQHandler();
     } else {
     BSP_I2C1_EV_IRQHandler();
     }
     /* USER CODE BEGIN I2C1_IRQn 1 */
     
     /* USER CODE END I2C1_IRQn 1 */
    }

    Rgds

    BT

    zovkorallAuthor
    Visitor II
    December 16, 2019

    Hi, Brian TIDAL.

    I am trying to add what you recommended - the error is the same.

    zovkorallAuthor
    Visitor II
    December 16, 2019

    Brian TIDAL, sorry for previos letter.

    I just reboot all sysytem and rebuild project.

    All works!

    Thanks!

    Technical Moderator
    December 16, 2019

    ​Hi,

    thanks for the update. This issue will be taken into account for the next release.

    Rgds

    BT