You are here

Timer and CapSense at BLE | Cypress Semiconductor

Timer and CapSense at BLE

Summary: 2 Replies, Latest post by schwarz on 22 Nov 2016 01:21 PM PST
Verified Answers: 0
Last post
Log in to post new comments.
schwarz's picture
User
22 posts

Hi,

I have to read-out an 8 bit shift register with 50 Hz. For that I have to toggle the clock pin with 6 us for about 20 times, then wait 20 ms. What would be the best way to do so? With BLE I can only use the WDT to wake up, I think, but with 6 us I cannot save power. Perhaps I could do the read-out faster, but how could I prevent the BLE to go in deep sleep (so I could use a normal timer)? I also want to measure the battery, but this could be timed with a software timer based on the WDT.

Another thing what I am not sure about: if I don't use the WDT, would the BLE be kept alive if connected? Or does it stay in deep sleep forever?

When all this works I want to use CapSense buttons to start the BLE advertising (and perhaps other functions when connected). This don't have to be fast, only for wake up. Can I use the WDT to read buttons if BLE is not connected or are there any things I have to consider?
What CapSense module should I use? CapSense v3.10 or CapSense CSD v2.50?

Regards,

schwarz

Anjana Muralidharan's picture
Cypress Employee
62 posts

Hi Schwarz,

Could you please let me know which Cy part you are using(PSoC/PRoC)? If PSoC you can use the Shift Register component. Else if PRoC part, you can follow the method which you mentioned. 

Q) if I don't use the WDT, would the BLE be kept alive if connected? Or does it stay in deep sleep forever?

A) Even WDT is not there, BLESS interrupt will make the device wake up from deepsleep. Please refer our Low power appnote for reference: http://www.cypress.com/documentation/application-notes/an92584-designing...

Q) What CapSense module should I use? CapSense v3.10 or CapSense CSD v2.50?

You can use the latest version itself (3.10)

Thanks,

Anjana

schwarz's picture
User
22 posts

Hi Anjana,

I'm using the PRoC.

I would like to use interrupts instead of using delays for ADC and the short pulses (6 us). Could I stay in sleep instead of deepsleep mode to keep the ADC and the timers alive? This would need some more power but I could use the WDT with 1 ms or more for a software timer. Below is my LowPowerImplementation, I would extend it with requests for the running ADC and fast timer (ADC is running -> stay in sleep).

Is the TCPWM module configured as timer running in sleep mode? I'm not sure which type it is in table 2 of the AN86233.

If I want to send one notification all 20 ms (maximum) what connection interval should I set? What is the correct place to set it? GAP Settings -> Peripheral preferred connection parameters -> min/max?

My device is a peripheral. If it is disconnected it tries to connect again, but if the central is turned off I want to use the touch to restart advertising. Should I use CyBle_Stop() for this, than I could start from the beginning? Perhaps I could do a soft reset, but this would be the clean solution.

Thanks for your help and sorry for the many questions, but this is new to me.

static void LowPowerImplementation(void) {
  CYBLE_LP_MODE_T lpMode;
  CYBLE_BLESS_STATE_T blessState;

  if(CyBle_GetState() != CYBLE_STATE_INITIALIZING)
  {
    /* Enter DeepSleep mode between connection intervals */
    lpMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);
    /* Disable global interrupts */
    uint8 interruptStatus = CyEnterCriticalSection();
    blessState = CyBle_GetBleSsState();

    if(lpMode == CYBLE_BLESS_DEEPSLEEP) 
    {   
      if(blessState == CYBLE_BLESS_STATE_ECO_ON || blessState == CYBLE_BLESS_STATE_DEEPSLEEP)
      {
        Sleep();
        CySysPmDeepSleep();
        Wakeup();
      }
    }
    else
    {
      if(blessState != CYBLE_BLESS_STATE_EVENT_CLOSE)
      {
        Sleep();
        /* change HF clock source from IMO to ECO, as IMO can be stopped to save power */
        CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); 
        /* stop IMO for reducing power consumption */
        CySysClkImoStop(); 
        
        /* put the CPU to sleep */
        CySysPmSleep();
        
        /* starts execution after waking up, start IMO */
        CySysClkImoStart();
        
        /* change HF clock source back to IMO */
        CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO);
        Wakeup();
      }
    }
    /* Enable global interrupt */
    CyExitCriticalSection(interruptStatus);
  }
}

Log in to post new comments.