infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: XMC4800 Interrupt by RTC_XTAL1

  1. #1
    New Member New Member Cris06 is on a distinguished road
    Join Date
    May 2018
    Posts
    1
    Points
    30

    XMC4800 Interrupt by RTC_XTAL1

    I'd like to generate an IRQ by a falling edge on RTC_XTAL1. For this I can use ERU0, 1B1.
    Can someone tell me how to configurate the MCU for this purpose?
    Im using an XMC4800F144.

  2. #2
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    DRubeša will become famous soon enough
    Join Date
    Jul 2016
    Location
    München
    Posts
    169
    Points
    2422.5
    Hi,

    unfortunately, I don´t have a complete working solution but I guess it´s better to show you how it could be realized. Maybe you also notice some small detail that I missed.

    Code:
    #include "xmc_scu.h"
    #include "xmc_gpio.h"
    #include "xmc_eru.h"
    
    const XMC_ERU_ETL_CONFIG_t eru_etl_config =
    {
      .input_b = ERU0_ETL1_INPUTB_SCU_HIB_SR1,
      .enable_output_trigger = 1,
      .output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL1,
      .source = XMC_ERU_ETL_SOURCE_B,
      .status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL,
      .edge_detection = XMC_ERU_ETL_EDGE_DETECTION_FALLING
    };
    
    const XMC_ERU_OGU_CONFIG_t eru_ogu_config =
    {
      .peripheral_trigger         = 0U, /* OGU input peripheral trigger */
      .enable_pattern_detection   = false, /* Enables generation of pattern match event */
      .service_request            = XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER, /* Interrupt gating signal */
      .pattern_detection_input    = 0U
    };
    
    void IRQ_Hdlr_2 (void)
    {
    	uint8_t index;
    
    	index = 0;			// used just to set the breakpoint, unfortunately this point in code is not reached
    }
    
    int main(void)
    {
      XMC_ERU_ETL_Init(XMC_ERU0, 1, &eru_etl_config);
      XMC_ERU_OGU_Init(XMC_ERU0, 1, &eru_ogu_config);
    
      XMC_SCU_HIB_RTCCLKSRC_t currentStdbyClock;
    
      if (XMC_SCU_HIB_IsHibernateDomainEnabled() == false)
      {
    	  XMC_SCU_HIB_EnableHibernateDomain();
      }
    
      XMC_SCU_CLOCK_EnableLowPowerOscillator();
    
      // this part is added just for testing, enabling low power EXTERNAL oscillator should be sufficient
      XMC_SCU_HIB_SetStandbyClockSource(XMC_SCU_HIB_STDBYCLKSRC_OSCULP);
      XMC_SCU_HIB_SetRtcClockSource(XMC_SCU_HIB_RTCCLKSRC_ULP);
    
      currentStdbyClock = XMC_SCU_HIB_GetStdbyClockSource();
    
      NVIC_SetPriority((IRQn_Type)2, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 63, 0));
      NVIC_EnableIRQ((IRQn_Type)2);
    
      /* Loop forever */
      while (1)
      {
    
      }
    }
    The code doesn´t reach interrupt routine and there is not even status flag set which will signify that falling edge is detected. I´ve tried also with rising and both edges and it doesn´t seem to have an impact. When I tried the use some of the buttons with similar code (different board, different input pin, different ERU module and different interrupt service routine) I was successful, which may me lead that maybe the voltage level transition on a RTC_XTAL1 pin are not sufficient to trigger ERU module edge detection. But again, maybe this is working fine but there are some issues with initialization which currently I don´t see. So try it by yourself and see if you see some issues with the code.

    Best regards,
    Deni
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.