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.

[FAQ] IWRL6432: Toggling a GPIO to indicate presence detection

Part Number: IWRL6432

The IWRL6432 can be used to detect presence for video camera systems. Integrating the IWRL6432 radar into an existing camera solution may require the user to send a signal to the camera from the radar when presence is detected. This post shows how to toggle a GPIO to indicate that presence is detected.

Step 1 - Build the presence and motion detection project

Follow the instructions on TiRex for building the presence and motion detection demo at this link. Follow the instructions all the way through the Build the Firmware from Source Code section.

Step 2 - Modify the demo.

Step 2.1 - Add the GPIO in sysconfig

In example.syscfg, add another GPIO. Name it presence_detect_gpio, and assign it the GPIO pin of your choice.

Note - If using the IWRL6432BOOST EVM, for debugging purposes, it may be easiest to tie this GPIO to the USER_LED on the IWRL6432BOOST device. If so, remove all references to the GPIO_LED (including the GPIO_pinWriteLow/High functions), and tie the presence_detect_gpio to PAD_AV/J10. You will need to remove all references to the GPIO_LED from the project files too. Otherwise, you may assign it to any GPIO available on the device.

Step 2.2 - Instantiate the GPIO in motion_detect().

In motion_detect.c, in the motion_detect() function, add the following code after the drivers and board drivers are opened.

    // Configure the LED GPIO
    gpioBaseAddrLed = (uint32_t) AddrTranslateP_getLocalAddr(PRESENCE_DETECT_GPIO_BASE_ADDR);
    pinNumLed       = PRESENCE_DETECT_GPIO;
    GPIO_setDirMode(gpioBaseAddrLed, pinNumLed, PRESENCE_DETECT_GPIO_DIR);

Step 2.3 - Toggle the GPIO if presence is detected in the presence_detection state machine.

Add the following code to mmwDemo_DpcExecute() in motion_detect.c

 

        if (gMmwMssMCB.isMotionPresenceDpuEnabled)
        {
            outParmsMpdproc.mpdZoneState = gMmwMssMCB.dpcZoneState;

            retVal = DPU_MpdProc_process(gMmwMssMCB.mpdProcDpuHandle, &outParmsMpdproc);
            if(retVal != 0){
                CLI_write("DPU_MpdProc_process failed with error code %d", retVal);
                DebugP_assert(0);
            }

            //outParmsMpdproc.minMpdCentroid gives the range of nearest cluster from Radar position
            gTestMinMpdCentroid = outParmsMpdproc.minMpdCentroid;

            // begin additions
            uint8_t i = 0;
            uint8_t presence_detected = 0;
            // If presence is detected in ANY of the zones, turn on the LED. Else, turn the LED off.
            // Index from 1 bc the first element is the number of zones.
            for(i = 1; i < ((uint8_t)ceil(gMmwMssMCB.sceneryParams.numBoundaryBoxes/4.0) + 1) * sizeof(uint8_t); ++i){
                if(outParmsMpdproc.mpdZoneState[i] > 0){
                    presence_detected = 1;
                    break;
                }
            }
            if(presence_detected == 1){
                GPIO_pinWriteHigh(gpioBaseAddrLed, pinNumLed);
            }
            else
            {
               GPIO_pinWriteLow(gpioBaseAddrLed, pinNumLed);
            }
            // end additions

        }

Step 3 - Run the demo.

Flash the IWRL6432 with the updated binary, and run the demo. See that when the zone presence changes from blue to red, the green USER_LED toggles on/off as well. 

                 

Configuration Used Below :

low_power_FCCSP_rectangle_BB.cfg