This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

WEBENCH® Tools/CC2538: CC2538: Wake up from PM2 with GPIO

Part Number: CC2538
Other Parts Discussed in Thread: Z-STACK,

Tool/software: WEBENCH® Design Tools

Hi,

I have a problem, when I want wake up CC2538 from PM2 with external interrupt (GPIO). When I use debugger JTAG it's working good but when I don't use the CC2538 only wake up with timeout.

Stack: Z-Stack 3.0.2

IDE: IAR 8.30.1

Sample APP: GenericApp

define region SRAM = mem: [from 0x20004000 to 0x20007FFF]

The same application on Z-Stack 2.5.1a with the same hardware works good.

Regards

  • Hi Munar,

    With what code are you initializing the pin trigger?  Also, do you mean that the interrupt triggers in a debugger session but not free-running, or that a physical JTAG connection is required for expected operation as compared to supplying just power?  Please refer to the cc2538_foundation_firmware_1_0_1_0\driverlib\cc2538\examples\gpio project from CC2538-SW: http://www.ti.com/tool/cc2538-sw 

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for replying! Appreciate it.. Sometime when I do a debugger session before enter in initialization GPIO the IDE ask me the new path of the \cc2538_foundation_firmware_1_0_1_0\bsp\srf06eb_cc2538\drivers\source\io_pin_int.c and I do update the path the file. After that it´s working good.

    I configured the interrupt this way:

    // Disable Interrupts on ACC pin INT0 before config
    GPIOPinIntDisable(ACC_INT_BASE, ACC_INT_PIN);

    // Set pin as input to get values from the outside devices
    GPIOPinTypeGPIOInput(ACC_INT_BASE, ACC_INT_PIN);

    // Set pin in high impedande
    IOCPadConfigSet(ACC_INT_BASE, ACC_INT_PIN, IOC_OVERRIDE_DIS);

    // Set trigger type
    GPIOIntTypeSet(ACC_INT_BASE, ACC_INT_PIN, GPIO_RISING_EDGE);

    // Connect my_event() to ACC_INT_PIN
    ioPinIntRegister(ACC_INT_BASE, ACC_INT_PIN, &my_event);

    Regards,
    Munar

  • Hi Munar,

    And after you exit the debugger or reset the device, does it still work?  What happens when you only program the hex image (no debugging)?

    Regards,
    Ryan

  • Hi Ryan,

    When I exit the debugger and don´t reset the device it  works well (I think tthat works with debugger configuration). If I do restart the device it  only wakes up from PM2 with timer timeout . When I program the hex image it only wakes up from PM2 with timer timeout.

    Regards, 
    Munar

  • Hi Ryan,

    Without debugger, if I use timeout timer equal than 1 second the external interrupt works. When I put timeout timer more than 1 second the external interrupt doesn't work.

    Regards,

    Munar

  • Hi Munar,

    Can you send me all code changes to GenericApp so that I can attempt to replicate this behavior?  I assume you are using the ZED build configuration, do you commission the device into a network before testing and what is the POLL_RATE?  Can you evaluate with a SMARTRF06EB and CC2538EVM to determine whether the issue is related to hardware?

    Regards,
    Ryan

  • Hi Ryan,

    Sorry for delay. I follow all steps that you said, I tried with another board and had the same problem. I used the Oscilloscope and saw the trigger of interruption but doesn't wakes from the PM2. 

    About the changes in code, I only added two events, the first for send send the periodic messages, and the second for send the message when we have an interrupt from the accelerometer.

    Regards,
    Munar

  • void init_ISR(void) {

    // Disable Interrupts on pin INT0 before config
    GPIOPinIntDisable(ACC_INT_BASE, ACC_INT_PIN);

    // Set pin as input to get values from the outside devices
    GPIOPinTypeGPIOInput(ACC_INT_BASE, ACC_INT_PIN);

    // Set pin in high impedande
    IOCPadConfigSet(ACC_INT_BASE, ACC_INT_PIN, IOC_OVERRIDE_DIS);

    // Set trigger type
    GPIOIntTypeSet(ACC_INT_BASE, ACC_INT_PIN, GPIO_RISING_EDGE);

    // Connect my_event() to ACC_INT_PIN
    ioPinIntRegister(ACC_INT_BASE, ACC_INT_PIN, &my_event);

    init_accelerometer();

    // Enable interrupt on ACC pin
    GPIOPinIntEnable(ACC_INT_BASE, ACC_INT_PIN);


    // Enable processor interrupts.
    IntMasterEnable();

    }

    void my_event (void){

    /0. Turn it off in order

    GPIOPinIntDisable(ACC_INT_BASE, ACC_INT_PIN);

    //1. Check how many ISR we have

    my_app.index += 1;
    send_packet(&my_struct,sizeof(my_struct));

    // Clear and Enable interrupts again
    GPIOPinIntClear(ACC_INT_BASE, ACC_INT_PIN);
    GPIOPinIntEnable(ACC_INT_BASE, ACC_INT_PIN);

    // Enable processor interrupts.
    IntMasterEnable();

    }

  • I think the issue is that you have not initialized the GPIOs as wake up events with GPIOIntWakeupEnable.  I suggest you reference SysCtrlWakeupSetting from hal_sys_ctrl.c, it would also be good for you to evaluate the SampleSwitch EndDevice configuration as it uses hal_board_cfg.h and hal_key.c to initialize and manage button presses on the SMARTRF06EB while operating the CC2538EVM as a sleepy node.

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for you help!

    Regards,
    Munar