This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Taiyo EYSGCNZWY problem with timers

Hi!,

I've made a custom board using Taiyo EYSGCNZWY bluetooth module, to be used as central in a project. To use this module, several changes have to be made in the clock configuration, because it uses 32MHz, instead of 16MHz of EVBoards and other modules. I've suffered a lot to make it work in the HRSC example, from this example I'm developing my software and I need 4 timers.

The problem begins when I want to start a timer, I get a INVALID STATE error. In the config I've enabled RTC1 and Timer1, but it doesn't work.

Can anybody help me with this desperate problem?

Thanks in advance

  • Ok, I've solved this following the timers usage from another example (ble_peripheral/hrs) and now it works. I had not used the macro APP_TIMER_DEF, and I had enabled the timers in sdk_config. Now the timers are working, but I can not get the button release event in the BSP.

  • Hi!

    Great to hear that the timer issue is solved.

    Regarding your GPIO-issue: If you are using BSP, I'd recommend moving over to using app_button instead. BSP cannot give multiple events on one button (like _PUSH and _RELEASE), unfortunately.

    The example ble_app_multilink_central in SDK v12 uses the app_button, and you can have a look at that as a starting point.

    Example of init function:

    static void buttons_init(void)
    {
       //The array must be static because a pointer to it will be saved in the button handler module.
        static app_button_cfg_t buttons[] =
        {
            {BUTTON_1, false, BUTTON_PULL, button_event_handler},
            {BUTTON_2, false, BUTTON_PULL, button_event_handler},
            /* Add entries here if required */
        };
    
        uint32_t err_code = app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]),
                                            BUTTON_DETECTION_DELAY);
        APP_ERROR_CHECK(err_code);
    }

    Here's how to make the button handler for checking both push and release:

    static void button_event_handler(uint8_t pin_no, uint8_t button_action)
    {
        switch (pin_no)
        {
            case LEDBUTTON_BUTTON_PIN:
                if (button_action == APP_BUTTON_PUSH)
                {
                }
                else if (button_action == APP_BUTTON_RELASE)
                {
                }
                break;
    
            default:
                APP_ERROR_HANDLER(pin_no);
                break;
        }
    }

    Best regards,

    Håkon

  • Thanks Håkon!

    I've used a timer to check the release event and now it's working fine. I think I'll keep using BSP, because I'm using the startup_event functionality and it's working as expected.

Related