Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/LAUNCHXL-CC2640R2: How can I capture 240nS pulse which comes from AFE4404 using CC2640R2 under RTOS condition?

$
0
0

Part Number:LAUNCHXL-CC2640R2

Tool/software:TI-RTOS

Hello.

Now I have some problem about interrupt under RTOS environments.

The problem is about AFE4404's ADC_RDY signal.

Before I ask the Q.

I will add my code first.

------------------------------------------------------------------------------------------------------------------------------------

1. I've define EVT first  :

define SBC_KEY_CHANGE_EVT                    0x0003

2. Add EvtHdr  :

// App event passed from profiles.
typedef struct
{
  appEvtHdr_t hdr; // event header
  uint8_t *pData;  // event data
} sbcEvt_t;

3. Declaration function about interrupt handler  :

static void SimpleBLECentral_handleKeys(uint8_t shift, uint8_t keys);
void SimpleBLECentral_keyChangeHandler(uint8 keys);
static uint8_t SimpleBLECentral_enqueueMsg(uint8_t event, uint8_t status, uint8_t *pData);

4. And set interrupt in static void SimpleBLEPeripheral_init(void)  :

      Board_initKeys(SimpleBLECentral_keyChangeHandler);

5. Add SBC_KEY_CHANGE_EVT to static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *pMsg).

6. This is what I do in interrput.  :

/*********************************************************************
 * @fn      SimpleBLECentral_handleKeys
 *
 * @brief   Handles all key events for this device.
 *
 * @param   shift - true if in shift/alt.
 * @param   keys - bit field for key events. Valid entries:
 *                 HAL_KEY_SW_2
 *                 HAL_KEY_SW_1
 *
 * @return  none
 */
static void SimpleBLECentral_handleKeys(uint8_t shift, uint8_t keys)
{
    (void)shift;  // Intentionally unreferenced parameter

    if (keys & KEY_LEFT)
    {
        BTN_CNT++;
        I2C_Get_Data(ACC, txBuffer, rxBuffer,i2c, &i2cTransaction, dispHandle);
        I2C_Get_Data(AFE, txBuffer, rxBuffer,i2c, &i2cTransaction, dispHandle);
    }


    if (keys & KEY_RIGHT)
    {
      BTN_CNT++;
      //PIN_setOutputValue(ledPinHandle, Board_RLED, 0);
            I2C_Get_Data(ACC, txBuffer, rxBuffer,i2c, &i2cTransaction, dispHandle);
    }
}

/*********************************************************************
 * @fn      SimpleBLECentral_enqueueMsg
 *
 * @brief   Creates a message and puts the message in RTOS queue.
 *
 * @param   event - message event.
 * @param   state - message state.
 * @param   pData - message data pointer.
 *
 * @return  TRUE or FALSE
 */
static uint8_t SimpleBLECentral_enqueueMsg(uint8_t event, uint8_t state,
                                           uint8_t *pData)
{
  sbcEvt_t *pMsg = ICall_malloc(sizeof(sbcEvt_t));

  // Create dynamic pointer to message.
  if (pMsg)
  {
    pMsg->hdr.event = event;
    pMsg->hdr.state = state;
    pMsg->pData = pData;

    // Enqueue the message.
    return Util_enqueueMsg(appMsgQueue, syncEvent, (uint8_t *)pMsg);
  }

  return FALSE;
}
/*********************************************************************
 * @fn      SimpleBLECentral_keyChangeHandler
 *
 * @brief   Key event handler function
 *
 * @param   a0 - ignored
 *
 * @return  none
 */
void SimpleBLECentral_keyChangeHandler(uint8 keys)
{
    SimpleBLECentral_enqueueMsg(SBC_KEY_CHANGE_EVT, keys, NULL);
}

------------------------------------------------------------------------------------------------------------------------------------

But problem is....

This interrupt thread can capture button push on launchpad.

But after I connect to AFE's ADC_RDY signal to get AFE data synchronized with AFE conversion time, this thread can't capture 240ns pulse from AFE's ADC_RDY pin.

Is there any way to capture this short signal?

And also to initialize AFE, I need to make 25~50uS low output state for initialize AFE(use RESETZ PIN).

But in RTOS environmentsm I can't make proper time delay.

This delay quastion is already concerned with my local distributor technical support team.

I need help.

thanks to read my Q.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>