XM125 and the redboard. error: 7

I don’t get it. this stuff is brand new, the xm125, the redboard, the cable. Example 01 of the xm125 works although the data produced is lousy. Now I want to run example 6 and when it runs I get this error: 7 and no data. Please advise.

15:48:32.339 -> 
15:48:32.339 -> -------------------------------------------------------
15:48:32.339 -> XM125 Example 6: Basic Distance Readings
15:48:32.339 -> -------------------------------------------------------
15:48:32.339 -> waiting 5 seconds.
15:48:37.340 -> go:
15:48:37.340 -> Starting Sensor...
15:48:37.340 -> 
15:48:37.666 -> Distance Detection Start Setup Error: 7
15:48:37.666 -> 
15:48:37.666 -> Distance Detection Started - range: 500mm to 5000mm (0.50m to 5.00m )
15:48:37.666 -> 

Example 1-5 use the ‘presence detection’ firmware, 6-9 use the ‘distance’ version - check out the hookup guide for info on how swapping them works :smiley:

thank you for your answer. so I have to download a different firmware directly to the xm125 board?

Yep - that guide I linked walks ya through it, but essentially there are different firmware(s) differently optimized, and which one you’ll eventually use depends on the use-case

TS-Russell,

Thank you!!! I’ve got Example07 working just the way I want to now!
Onto the the next issue If I can trouble you. The code is written in a classic C++ class/method model, which of course, makes it virtually impossible to figure anything out. I can see I can get some data out of the sparkfun XM125 breakout board:

219
220 // Read PeakX Distance and PeakX Strength registers for the number of distances detected
221 radarSensor.getPeak0Distance(distancePeak0);
222 radarSensor.getPeak0Strength(distancePeakStrength0);
223 radarSensor.getPeak1Distance(distancePeak1);
224 radarSensor.getPeak1Strength(distancePeakStrength1);
225

But how do I just send a message and get a uart response of other data? There are 100’s of methods and I can’t find the tree in the forest.
I want to change the firmware in the XM125 chip, (I can build the .bin file now.) and I "~think~” I see where the XM125 chip responds to the getpeak0distance command:

835 static void print_distance_result(const acc_detector_distance_result_t *result)
836 {
837 uart_log(“%d detected distances”, result->num_distances);
838 if (result->num_distances > 0)
839 {
840 uart_log(“: “);
841 for (uint8_t i = 0; i < result->num_distances; i++)
842 {
843 uint32_t distance_mm = (uint32_t)(1000 * result->distances[i]);
844 uart_log(”%” PRIu32 "mm, ", distance_mm);
845 }
846 }

so now I want to see the actual message that the arduino receives so I can modify behavior.

for example in line 844 I want to change “PRIu32” to “hey look I changed this! PRIu32” and verify a round trip communication I can control. Any ideas or maybe help find the peak0distance actual code?

I’m not familiar with the code, but I’d recommend trying to enlist an AI like kimi.com to help navigate the intricacies…I’ve had a lot of success with that model and Claude.com

Let the AI know what you’re after and upload the file a a txt file and it should be able to get it going with your custom message etc