Skip to content

Commit 76426e2

Browse files
authored
Merge pull request #205 from Infineon/24Ghz-radar
24 ghz radar into develop to fix Radar library example errors
2 parents 12f8b04 + a2a967e commit 76426e2

File tree

16 files changed

+413
-84
lines changed

16 files changed

+413
-84
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This repository integrates [Infineon's](https://www.infineon.com/) XMC microcont
2121
* [XMC1300 Sense2GoL](https://www.infineon.com/cms/de/product/evaluation-boards/demo-sense2gol/)
2222
* [XMC4400 Platform 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_plt2go_xmc4400//)
2323
* [XMC4700 Relax Kit](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc47_relax_v1/)
24-
* [DEMO Radar BB XMC4700](https://www.infineon.com/cms/en/product/evaluation-boards/demo-sense2gol-pulse/)
24+
* [XMC4700 Radar Baseboard](https://www.infineon.com/cms/en/product/evaluation-boards/demo-sense2gol-pulse/)
2525

2626

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

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

boards.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ XMC4400_Platform2GO.menu.LIB.DSP=ARM DSP
391391
XMC4400_Platform2GO.menu.LIB.DSP.library.selected=-DARM_LIB_CMSIS_DSP
392392

393393
####################################################
394-
XMC4700_Radar_Baseboard.name=DEMO Radar BB XMC4700
394+
XMC4700_Radar_Baseboard.name=XMC4700 Radar Baseboard
395395
XMC4700_Radar_Baseboard.upload.tool=xmcprog
396396
XMC4700_Radar_Baseboard.upload.speed=115200
397397
XMC4700_Radar_Baseboard.upload.resetmethod=ck

keywords.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ LED6 LITERAL1
5454
BUTTON1 LITERAL1
5555
BUTTON2 LITERAL1
5656

57-
# Radar Baseboard XMC4700 only
57+
# XMC4700 Radar Baseboard only
5858
LED_RED LITERAL1
5959
LED_BLUE LITERAL1
6060
LED_GREEN LITERAL1

libraries/BGT24LTR11-Pulsed-Doppler-Radar/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Two Arduino sketch examples are provided in the current library release. These e
9191
This example sketch runs the Pulsed Doppler firmware and uses the on-board LED to indicate detection of motion and direction of motion.
9292

9393
**Hardware required:**
94-
Radar Baseboard XMC4700 and BGT24LTR11 Shield
94+
XMC4700 Radar Baseboard and BGT24LTR11 Shield
9595

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

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

111-
4. Attach the BGT24LTR11 Shield to the Radar Baseboard XMC4700 via the SAMTEC connectors.
111+
4. Attach the BGT24LTR11 Shield to the XMC4700 Radar Baseboard via the SAMTEC connectors.
112112

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

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

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

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

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

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

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

161-
4. Attach the BGT24LTR11 Shield to the Radar Baseboard XMC4700 via the SAMTEC connectors.
161+
4. Attach the BGT24LTR11 Shield to the XMC4700 Radar Baseboardvia the SAMTEC connectors.
162162

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

165-
5. Stack the RGB LED Lighting Shield with XMC1202 onto the Radar Baseboard XMC4700 via the Arduino stack headers.
165+
5. Stack the RGB LED Lighting Shield with XMC1202 onto the XMC4700 Radar Baseboard via the Arduino stack headers.
166166
Also connect an RGB LED and a 24 VDC power adapter to the RGB LED Lighting Shield. **Do not turn the power on yet!**
167167
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).
168168

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

171171
6. Stack the Annikken Andee U shield onto the setup. Notice that there are several jumper wires on the Annikken Andee U board.
172-
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).
172+
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).
173173
The second diagram below illustrates the required connections.
174174

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

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

179-
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.
179+
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.
180180

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

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

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

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

205205
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.
206206

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,72 @@
11
#include <IFXRadarPulsedDoppler.h>
2+
#include <LED.h>
23

34
// IFX Radar Pulsed Doppler Object
45
IFXRadarPulsedDoppler radarDev;
6+
LED Led;
57

6-
void myResultCallback()
8+
void myErrorCallback( uint32_t error )
9+
{
10+
11+
12+
Led.On( LED_GREEN );
13+
Led.On( LED_RED );
14+
Led.On( LED_BLUE );
15+
16+
while( 1 )
17+
;
18+
}
19+
20+
21+
void myResultCallback(void)
722
{
823
uint8_t targetDirection = radarDev.getDirection();
924
if(targetDirection == 1)
1025
{
1126
// turn on Red LED for departing target
12-
digitalWrite(LED_GREEN, HIGH);
13-
digitalWrite(LED_RED, LOW);
14-
digitalWrite(LED_BLUE, HIGH);
27+
Led.Off( LED_GREEN );
28+
Led.On( LED_RED );
29+
Led.Off( LED_BLUE );
1530
}
1631
else if(targetDirection == 2)
1732
{
1833
// turn on Green LED for approaching target
19-
digitalWrite(LED_GREEN, LOW);
20-
digitalWrite(LED_RED, HIGH);
21-
digitalWrite(LED_BLUE, HIGH);
34+
Led.On( LED_GREEN );
35+
Led.Off( LED_RED );
36+
Led.Off( LED_BLUE );
2237
}
2338
else if(radarDev.targetAvailable() == true)
2439
{
2540
// turn on Blue LED for just normal motion with no meaningful direction
26-
digitalWrite(LED_GREEN, HIGH);
27-
digitalWrite(LED_RED, HIGH);
28-
digitalWrite(LED_BLUE, LOW);
41+
Led.Off( LED_GREEN );
42+
Led.Off( LED_RED );
43+
Led.On( LED_BLUE );
2944
}
3045
else
3146
{
3247
// turn off LEDs for no motion
33-
digitalWrite(LED_GREEN, HIGH);
34-
digitalWrite(LED_RED, HIGH);
35-
digitalWrite(LED_BLUE, HIGH);
48+
Led.Off( LED_GREEN );
49+
Led.Off( LED_RED );
50+
Led.Off( LED_BLUE );
3651
}
3752
}
3853

3954
void setup() {
40-
// put your setup code here, to run once:
41-
pinMode(LED_RED, OUTPUT);
42-
digitalWrite(LED_RED, HIGH);
43-
pinMode(LED_GREEN, OUTPUT);
44-
digitalWrite(LED_GREEN, LOW);
45-
pinMode(LED_BLUE, OUTPUT);
46-
digitalWrite(LED_BLUE, HIGH);
4755

48-
radarDev.initHW();
56+
Led.Add( LED_RED );
57+
Led.Add( LED_GREEN );
58+
Led.Add( LED_BLUE );
59+
60+
Led.Off( LED_RED );
61+
Led.Off( LED_GREEN );
62+
Led.Off( LED_BLUE );
63+
4964
radarDev.registerResultCallback(myResultCallback);
65+
radarDev.registerErrorCallback(myErrorCallback);
66+
67+
radarDev.initHW();
68+
69+
// start the radarDevice, to read the default parameter
5070
radarDev.begin();
5171

5272
}
@@ -55,3 +75,4 @@ void loop() {
5575
// put your main code here, to run repeatedly:
5676
radarDev.run();
5777
}
78+
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#include <IFXRadarPulsedDoppler.h>
2+
#include <LED.h>
3+
4+
// IFX Radar Pulsed Doppler Object
5+
IFXRadarPulsedDoppler radarDev;
6+
LED Led;
7+
8+
void myErrorCallback(uint32_t error)
9+
{
10+
Serial.print("--- ERROR: 0x");
11+
Serial.println( error, HEX);
12+
13+
Led.On( LED_GREEN );
14+
Led.On( LED_RED );
15+
Led.On( LED_BLUE );
16+
17+
while( 1 )
18+
;
19+
}
20+
21+
22+
void myResultCallback(void)
23+
{
24+
uint8_t targetDirection = radarDev.getDirection();
25+
if(targetDirection == 1)
26+
{
27+
// turn on Red LED for departing target
28+
Led.Off( LED_GREEN );
29+
Led.On( LED_RED );
30+
Led.Off( LED_BLUE );
31+
}
32+
else if(targetDirection == 2)
33+
{
34+
// turn on Green LED for approaching target
35+
Led.On( LED_GREEN );
36+
Led.Off( LED_RED );
37+
Led.Off( LED_BLUE );
38+
}
39+
else if(radarDev.targetAvailable() == true)
40+
{
41+
// turn on Blue LED for just normal motion with no meaningful direction
42+
Led.Off( LED_GREEN );
43+
Led.Off( LED_RED );
44+
Led.On( LED_BLUE );
45+
}
46+
else
47+
{
48+
// turn off LEDs for no motion
49+
Led.Off( LED_GREEN );
50+
Led.Off( LED_RED );
51+
Led.Off( LED_BLUE );
52+
}
53+
}
54+
55+
56+
float raw_i[256];
57+
float raw_q[256];
58+
59+
60+
void myRawDataCallback( raw_data_context_t context )
61+
{
62+
uint32_t frameCnt = radarDev.getRawDataFrameCount( context );
63+
uint16_t numSamples = radarDev.getNumRawDataSamples( context );
64+
65+
radarDev.getRawData( context, raw_i, raw_q, 256 );
66+
67+
for( uint32_t i = 0; i < numSamples; i++ )
68+
{
69+
Serial.print( raw_i[i] );
70+
Serial.print("\t");
71+
Serial.print( raw_q[i] );
72+
Serial.println( "" );
73+
}
74+
}
75+
76+
void setup() {
77+
78+
Led.Add( LED_RED );
79+
Led.Add( LED_GREEN );
80+
Led.Add( LED_BLUE );
81+
82+
Led.Off( LED_RED );
83+
Led.Off( LED_GREEN );
84+
Led.Off( LED_BLUE );
85+
86+
Serial.begin(500000); //This baudrate is required to show continuous wave on serial plotter, at minimum framerate (continuous sampling!)
87+
88+
radarDev.registerResultCallback(myResultCallback);
89+
radarDev.registerErrorCallback(myErrorCallback);
90+
radarDev.registerRawDataCallback(myRawDataCallback ); // register a handler to receive raw data
91+
//radarDev.enableAlgoProcessing( false ); // set to false to disables the lib internal radar algo processing
92+
93+
radarDev.initHW();
94+
95+
// start the radarDevice, to read the default parameter
96+
radarDev.begin();
97+
98+
// set minimum Frame period, to get continuous sampling of data, a skip count is required to remove the transient
99+
// in analog baseband after frame pause
100+
// set skip count to zero, in countinuous mode there is not transient that needs to be skipped.
101+
radarDev.setSkipSamples( 0 );
102+
103+
// read minimum possible Frame period (after setting skip count!)
104+
uint32_t minFramePeriod = radarDev.getMinFramePeriod();
105+
106+
// stop the device to change parameters
107+
radarDev.end();
108+
radarDev.setFramePeriod( minFramePeriod );
109+
110+
// legend for Serial Plotter:
111+
Serial.print("I-Signal\tQ-Signal-");
112+
Serial.println(minFramePeriod);
113+
114+
// Restart the radar device
115+
radarDev.begin();
116+
117+
}
118+
119+
void loop() {
120+
// put your main code here, to run repeatedly:
121+
radarDev.run();
122+
}
123+

0 commit comments

Comments
 (0)