Skip to content

Commit

Permalink
Merge pull request #205 from Infineon/24Ghz-radar
Browse files Browse the repository at this point in the history
24 ghz radar into develop to fix Radar library example errors
  • Loading branch information
boramonideep authored Oct 7, 2022
2 parents 12f8b04 + a2a967e commit 76426e2
Show file tree
Hide file tree
Showing 16 changed files with 413 additions and 84 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This repository integrates [Infineon's](https://www.infineon.com/) XMC microcont
* [XMC1300 Sense2GoL](https://www.infineon.com/cms/de/product/evaluation-boards/demo-sense2gol/)
* [XMC4400 Platform 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_plt2go_xmc4400//)
* [XMC4700 Relax Kit](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc47_relax_v1/)
* [DEMO Radar BB XMC4700](https://www.infineon.com/cms/en/product/evaluation-boards/demo-sense2gol-pulse/)
* [XMC4700 Radar Baseboard](https://www.infineon.com/cms/en/product/evaluation-boards/demo-sense2gol-pulse/)


## Additional Information
Expand All @@ -37,7 +37,7 @@ Please visit also the Wiki for additional information, e.g. datasheets, pin out
* Page for [XMC1300 Sense2GoL](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1300-Sense2GoL)
* Page for [XMC4400 Platform 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC4400-Platform2Go)
* Page for [XMC4700 Relax Kit](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC4700-Relax-Kit)
* Page for [DEMO Radar BB XMC4700](https://github.com/Infineon/XMC-for-Arduino/wiki/DEMO-Radar-BB-XMC4700)
* Page for [XMC4700 Radar Baseboard](https://github.com/Infineon/XMC-for-Arduino/wiki/DEMO-Radar-BB-XMC4700)

Additionally, please consult the [releases](https://github.com/Infineon/XMC-for-Arduino/releases) for information about the changes and new versions.

Expand Down
2 changes: 1 addition & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ XMC4400_Platform2GO.menu.LIB.DSP=ARM DSP
XMC4400_Platform2GO.menu.LIB.DSP.library.selected=-DARM_LIB_CMSIS_DSP

####################################################
XMC4700_Radar_Baseboard.name=DEMO Radar BB XMC4700
XMC4700_Radar_Baseboard.name=XMC4700 Radar Baseboard
XMC4700_Radar_Baseboard.upload.tool=xmcprog
XMC4700_Radar_Baseboard.upload.speed=115200
XMC4700_Radar_Baseboard.upload.resetmethod=ck
Expand Down
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LED6 LITERAL1
BUTTON1 LITERAL1
BUTTON2 LITERAL1

# Radar Baseboard XMC4700 only
# XMC4700 Radar Baseboard only
LED_RED LITERAL1
LED_BLUE LITERAL1
LED_GREEN LITERAL1
18 changes: 9 additions & 9 deletions libraries/BGT24LTR11-Pulsed-Doppler-Radar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Two Arduino sketch examples are provided in the current library release. These e
This example sketch runs the Pulsed Doppler firmware and uses the on-board LED to indicate detection of motion and direction of motion.

**Hardware required:**
Radar Baseboard XMC4700 and BGT24LTR11 Shield
XMC4700 Radar Baseboard and BGT24LTR11 Shield

**Steps:**
1. In Arduino IDE, navigate to **File** --> **Examples** --> **IFXRadarPulsedDoppler** --> **Radar_Pulsed_Doppler_LED**
Expand All @@ -108,11 +108,11 @@ Radar Baseboard XMC4700 and BGT24LTR11 Shield

![Done Compiling](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_done_compiling.png)

4. Attach the BGT24LTR11 Shield to the Radar Baseboard XMC4700 via the SAMTEC connectors.
4. Attach the BGT24LTR11 Shield to the XMC4700 Radar Baseboard via the SAMTEC connectors.

![Connecting Boards](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_connecting_boards.png)

5. Connect the Radar Baseboard XMC4700 to the PC via a USB cable onto the **Debug** USB port.
5. Connect the XMC4700 Radar Baseboard to the PC via a USB cable onto the **Debug** USB port.

![Debug Port](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_debug_port.png)

Expand All @@ -139,7 +139,7 @@ This example sketch runs the Pulsed Doppler firmware and projects the results of
and at the same time uses an external RGB LED to indicate motion and direction of motion.

**Hardware required:**
1) Radar Baseboard XMC4700 and BGT24LTR11 Shield
1) XMC4700 Radar Baseboard and BGT24LTR11 Shield
2) Annikken Andee U Shield (https://www.annikken.com/andee-u)
3) RGB LED Lighting Shield with XMC1202 (https://www.infineon.com/cms/en/product/evaluation-boards/kit_led_xmc1202_as_01/)

Expand All @@ -158,25 +158,25 @@ and at the same time uses an external RGB LED to indicate motion and direction o

![Done Compiling](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_done_compiling.png)

4. Attach the BGT24LTR11 Shield to the Radar Baseboard XMC4700 via the SAMTEC connectors.
4. Attach the BGT24LTR11 Shield to the XMC4700 Radar Baseboardvia the SAMTEC connectors.

![Connecting Boards](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_connecting_boards.png)

5. Stack the RGB LED Lighting Shield with XMC1202 onto the Radar Baseboard XMC4700 via the Arduino stack headers.
5. Stack the RGB LED Lighting Shield with XMC1202 onto the XMC4700 Radar Baseboard via the Arduino stack headers.
Also connect an RGB LED and a 24 VDC power adapter to the RGB LED Lighting Shield. **Do not turn the power on yet!**
For more information on setting up of the RGB LED Lighting Shield, please refer to [Infineon RGB LED Lighting Shield with XMC1202 for Arduino - User Manual](https://www.infineon.com/dgdl/Infineon-Board_Manual_-_XMC1202_-_RGB_LED_Lighting_Shield_with_XMC1202_for_Arduino_-_v1_0-UM-v01_00-EN.pdf?fileId=5546d46249be182c0149ccca3860734d).

![RGB LED Shield Setup](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_RGB_LED_Shield_Setup.png)

6. Stack the Annikken Andee U shield onto the setup. Notice that there are several jumper wires on the Annikken Andee U board.
This is due to the hardware modifications required on the Radar Baseboard regarding the ISCP header as mentioned in [the XMC4700 Radar Baseboard Wiki](https://github.com/Infineon/XMC-for-Arduino/wiki/Radar-Baseboard-XMC4700).
This is due to the hardware modifications required on the Radar Baseboard regarding the ISCP header as mentioned in [the XMC4700 Radar BaseboardWiki](https://github.com/Infineon/XMC-for-Arduino/wiki/Radar-Baseboard-XMC4700).
The second diagram below illustrates the required connections.

![Annikken Andee U](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_Annikken_Andee_U.png)

![Andee Jumpers](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_Andee_Jumpers.png)

7. Turn on the 24 VDC power supply to the RGB LED Lighting Shield and connect the Radar Baseboard XMC4700 to the PC via a USB cable onto the **Debug** USB port.
7. Turn on the 24 VDC power supply to the RGB LED Lighting Shield and connect the XMC4700 Radar Baseboard to the PC via a USB cable onto the **Debug** USB port.

![Debug Port](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_debug_port.png)

Expand All @@ -200,7 +200,7 @@ The RGB LED should turn on with white light, while the on-board LED will cycle b

![Andee GUI](https://raw.githubusercontent.com/infineon/assets/master/Pictures/rbb_Andee-GUI.png)

In case this does not happen, disconnect from the app, press the reset button on the Radar Baseboard XMC4700 and retry the connection.
In case this does not happen, disconnect from the app, press the reset button on the XMC4700 Radar Baseboard and retry the connection.

Make some movement in front of the radar board and observe the measured speed and detected direction on the GUI. You may also observe the light from the RGB LED changing with regards to the motion and its direction.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,72 @@
#include <IFXRadarPulsedDoppler.h>
#include <LED.h>

// IFX Radar Pulsed Doppler Object
IFXRadarPulsedDoppler radarDev;
LED Led;

void myResultCallback()
void myErrorCallback( uint32_t error )
{


Led.On( LED_GREEN );
Led.On( LED_RED );
Led.On( LED_BLUE );

while( 1 )
;
}


void myResultCallback(void)
{
uint8_t targetDirection = radarDev.getDirection();
if(targetDirection == 1)
{
// turn on Red LED for departing target
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_RED, LOW);
digitalWrite(LED_BLUE, HIGH);
Led.Off( LED_GREEN );
Led.On( LED_RED );
Led.Off( LED_BLUE );
}
else if(targetDirection == 2)
{
// turn on Green LED for approaching target
digitalWrite(LED_GREEN, LOW);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_BLUE, HIGH);
Led.On( LED_GREEN );
Led.Off( LED_RED );
Led.Off( LED_BLUE );
}
else if(radarDev.targetAvailable() == true)
{
// turn on Blue LED for just normal motion with no meaningful direction
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_BLUE, LOW);
Led.Off( LED_GREEN );
Led.Off( LED_RED );
Led.On( LED_BLUE );
}
else
{
// turn off LEDs for no motion
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_BLUE, HIGH);
Led.Off( LED_GREEN );
Led.Off( LED_RED );
Led.Off( LED_BLUE );
}
}

void setup() {
// put your setup code here, to run once:
pinMode(LED_RED, OUTPUT);
digitalWrite(LED_RED, HIGH);
pinMode(LED_GREEN, OUTPUT);
digitalWrite(LED_GREEN, LOW);
pinMode(LED_BLUE, OUTPUT);
digitalWrite(LED_BLUE, HIGH);

radarDev.initHW();
Led.Add( LED_RED );
Led.Add( LED_GREEN );
Led.Add( LED_BLUE );

Led.Off( LED_RED );
Led.Off( LED_GREEN );
Led.Off( LED_BLUE );

radarDev.registerResultCallback(myResultCallback);
radarDev.registerErrorCallback(myErrorCallback);

radarDev.initHW();

// start the radarDevice, to read the default parameter
radarDev.begin();

}
Expand All @@ -55,3 +75,4 @@ void loop() {
// put your main code here, to run repeatedly:
radarDev.run();
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#include <IFXRadarPulsedDoppler.h>
#include <LED.h>

// IFX Radar Pulsed Doppler Object
IFXRadarPulsedDoppler radarDev;
LED Led;

void myErrorCallback(uint32_t error)
{
Serial.print("--- ERROR: 0x");
Serial.println( error, HEX);

Led.On( LED_GREEN );
Led.On( LED_RED );
Led.On( LED_BLUE );

while( 1 )
;
}


void myResultCallback(void)
{
uint8_t targetDirection = radarDev.getDirection();
if(targetDirection == 1)
{
// turn on Red LED for departing target
Led.Off( LED_GREEN );
Led.On( LED_RED );
Led.Off( LED_BLUE );
}
else if(targetDirection == 2)
{
// turn on Green LED for approaching target
Led.On( LED_GREEN );
Led.Off( LED_RED );
Led.Off( LED_BLUE );
}
else if(radarDev.targetAvailable() == true)
{
// turn on Blue LED for just normal motion with no meaningful direction
Led.Off( LED_GREEN );
Led.Off( LED_RED );
Led.On( LED_BLUE );
}
else
{
// turn off LEDs for no motion
Led.Off( LED_GREEN );
Led.Off( LED_RED );
Led.Off( LED_BLUE );
}
}


float raw_i[256];
float raw_q[256];


void myRawDataCallback( raw_data_context_t context )
{
uint32_t frameCnt = radarDev.getRawDataFrameCount( context );
uint16_t numSamples = radarDev.getNumRawDataSamples( context );

radarDev.getRawData( context, raw_i, raw_q, 256 );

for( uint32_t i = 0; i < numSamples; i++ )
{
Serial.print( raw_i[i] );
Serial.print("\t");
Serial.print( raw_q[i] );
Serial.println( "" );
}
}

void setup() {

Led.Add( LED_RED );
Led.Add( LED_GREEN );
Led.Add( LED_BLUE );

Led.Off( LED_RED );
Led.Off( LED_GREEN );
Led.Off( LED_BLUE );

Serial.begin(500000); //This baudrate is required to show continuous wave on serial plotter, at minimum framerate (continuous sampling!)

radarDev.registerResultCallback(myResultCallback);
radarDev.registerErrorCallback(myErrorCallback);
radarDev.registerRawDataCallback(myRawDataCallback ); // register a handler to receive raw data
//radarDev.enableAlgoProcessing( false ); // set to false to disables the lib internal radar algo processing

radarDev.initHW();

// start the radarDevice, to read the default parameter
radarDev.begin();

// set minimum Frame period, to get continuous sampling of data, a skip count is required to remove the transient
// in analog baseband after frame pause
// set skip count to zero, in countinuous mode there is not transient that needs to be skipped.
radarDev.setSkipSamples( 0 );

// read minimum possible Frame period (after setting skip count!)
uint32_t minFramePeriod = radarDev.getMinFramePeriod();

// stop the device to change parameters
radarDev.end();
radarDev.setFramePeriod( minFramePeriod );

// legend for Serial Plotter:
Serial.print("I-Signal\tQ-Signal-");
Serial.println(minFramePeriod);

// Restart the radar device
radarDev.begin();

}

void loop() {
// put your main code here, to run repeatedly:
radarDev.run();
}

Loading

0 comments on commit 76426e2

Please sign in to comment.