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.

PGA460-Q1: test on BOOSTXL-PGA460, Threshold will seriously impact echo amplititude???

Part Number: PGA460-Q1
Other Parts Discussed in Thread: BOOSTXL-PGA460, ENERGIA, PGA460


I'm testing on a customer issue. test condition : BOOSTXL-PGA460, Energia , getDistance.ino, test object:0.6m.  test code as below attached. 

I've verfied the result between GUI and Energia. their perfomance including echo amplititude  are matched. but when I only changed Threshold in   pga460::initThresholds(byte thr) function, the dump result show the echo amplititude is quite different.  you can use my attached code and just change the Threshold as below to verify.  I've also tested on GUI, no matter how I change the Threshold, there are no big difference. please suggest how this threshold changing connecting to this echo amplititude?  thanks. 


test code: 


only changed  below code  in my attached file, You can verify this issue.

void pga460::initThresholds(byte thr)
switch (thr)
case 0: //25% Levels 64 of 255
P1_THR_0 = 0x0;
P1_THR_1 = 0x0;
P1_THR_2 = 0x0;
P1_THR_3 = 0x0;
P1_THR_4 = 0x0;
P1_THR_5 = 0x0;
P1_THR_6 = 0x0;
P1_THR_7 = 0x0;
P1_THR_8 = 0x0;
P1_THR_9 = 0x0;
P1_THR_10 = 0x0;
P1_THR_11 = 0x0;
P1_THR_12 = 0x0;
P1_THR_13 = 0x0;
P1_THR_14 = 0x88;
P1_THR_15 = 0x88;
P2_THR_0 = 0x88;
P2_THR_1 = 0x88;
P2_THR_2 = 0x88;
P2_THR_3 = 0x88;
P2_THR_4 = 0x84;
P2_THR_5 = 0x21;
P2_THR_6 = 0x8;
P2_THR_7 = 0x42;
P2_THR_8 = 0x10;
P2_THR_9 = 0x80;
P2_THR_10 = 0x80;
P2_THR_11 = 0x80;
P2_THR_12 = 0x80;
P2_THR_13 = 0x0;
P2_THR_14 = 0x88;
P2_THR_15 = 0x88;


  • Hi Yue,

    Instead of writing to the threshold registers using the initThresholds function, which performs a bulk threshold write, could they see if it makes a difference if they write to the individual threshold registers using regular register writes? For each register write, they can use the "ussc.registerWrite" function. In between each register write, also try adding a delay using the “delay(60)” function.

    If they still see the issue when writing to the threshold registers individually, can they try pinpointing after which register write do they start seeing issues?

    Thank you,


  • Mekre,

    Actually, from the final print out in my code, I can verify all the registers matched what I've wrote into, this should prove that whatever a bulk write or sigle write, should not affect the result, let me know if you have different thought.please see below print out.

    Also, I've spent a lot of time and test the thd registers one by one. please see below capture.  P1_THR_9 give the peak and P2_THR_14 give the bottom. my conclusion is one single register changed do not show huge difference. 

    2. If I changed all P1_THD,  I can observe big difference. 

    accoding to my understanding,  THD should not impact the echo ampltitude, but result show that is not true.

    please verify and provide a conclusion, why THD settings in Energia will get this difference. 

    BTW, My customer's target is very simple, I don't want you to help to locate a bug or something in Energia, could you please provide a workable code that we can use it to get a consistent results when import the settings from GUI. that will greatly help to meet my customer's MP schedule. thanks. 

    reigster print out:

    Register number:14, Register value:8D

    Register number:15, Register value:EE

    Register number:16, Register value:EF

    Register number:17, Register value:11

    Register number:18, Register value:B5

    Register number:19, Register value:20

    Register number:1A, Register value:C0

    Register number:1B, Register value:40

    Register number:1C, Register value:8F

    Register number:1D, Register value:A0

    Register number:1E, Register value:6

    Register number:1F, Register value:10

    Register number:20, Register value:54

    Register number:21, Register value:55

    Register number:22, Register value:19

    Register number:23, Register value:33

    Register number:24, Register value:EE

    Register number:25, Register value:7C

    Register number:26, Register value:8F

    Register number:27, Register value:0

    Register number:28, Register value:0

    Register number:29, Register value:2

    Register number:2A, Register value:9

    Register number:2B, Register value:8E

    Register number:40, Register value:0

    Register number:41, Register value:8A

    Register number:42, Register value:C

    Register number:43, Register value:F9

    Register number:44, Register value:A5

    Register number:45, Register value:3

    Register number:46, Register value:2D

    Register number:47, Register value:7E

    Register number:48, Register value:67

    Register number:49, Register value:0

    Register number:4A, Register value:CD

    Register number:4B, Register value:0

    Register number:4C, Register value:80

    Register number:4D, Register value:0

    Register number:5F, Register value:0

    Register number:60, Register value:0

    Register number:61, Register value:0

    Register number:62, Register value:0

    Register number:63, Register value:0

    Register number:64, Register value:0

    Register number:65, Register value:0

    Register number:66, Register value:0

    Register number:67, Register value:0

    Register number:68, Register value:0

    Register number:69, Register value:0

    Register number:6A, Register value:0

    Register number:6B, Register value:0

    Register number:6C, Register value:0

    Register number:6D, Register value:88

    Register number:6E, Register value:88

    Register number:6F, Register value:88

    Register number:70, Register value:88

    Register number:71, Register value:88

    Register number:72, Register value:88

    Register number:73, Register value:84

    Register number:74, Register value:21

    Register number:75, Register value:8

    Register number:76, Register value:42

    Register number:77, Register value:10

    Register number:78, Register value:80

    Register number:79, Register value:80

    Register number:7A, Register value:80

    Register number:7B, Register value:80

    Register number:7C, Register value:0

    Register number:7D, Register value:88

    Register number:7E, Register value:88

    Register number:7F, Register value:96

  • Hi Yue,

    We were not able to reproduce this issue with the Energia code examples we posted online. For the code that has this issue, please verify that the TVG values are as expected.