Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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: PGA460 communication with ESP32

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

Hi,

We have a PGA460 evm board, that will be used in measuring distance in air. Senor is 300kHz, distance 150 - 450 mm, accuracy should be 1 mm.

Everything works in case we use pga460 evaluation board, but next step is to connect it to esp32 via UART. 

We have done a hardware connection between esp32 chip and PGA460 chip, but software...

1) How could we setup PGA460 chip for exact parameters we need (frequency, no. of pulses, etc) ?

2) What is the structure of transmitted packages ?

  • Hi Oleg,

    For PGA$60 software development, I recommend that you start with the PGA460 Software Development Guide and PGA460 Energia Library and Code Example downloads. These will help guide you with UART specific examples.

    For information on the general structure of the UART packet, refer to section "7.3.6.2.1 USART Asynchronous Mode" of  the datasheet: http://www.ti.com/lit/ds/symlink/pga460-q1.pdf. Note the non-default 2-stop bit requirement for the UART configuration.

  • Hi Akeem,

    Thank you for your help, but now we have another problem.

    BOOSTXL-PGA460 kit with 300kHz sensor works fine on short distance. Data monitor (PGA460-Q1 EVM software) shows peak at the correct distance, which means the dump data is fine.

    However, we need the exact value of distance (time-of-flight). While trying in the Interface Mode, which returns the exact value, its either incorrect (for example: 40 2c e3 57 75 88, which corresponds to the distance of ~1.9m according to the equation from 7.3.6.2.1.5 PGA460-Q1 UART Commands (should be ~165mm)),

    or 40 FF FF FF FF (which appears if the measurement request was sent from the Interface Mode). The "incorrect" value is the return of Ultrasonic Measurement command right after performing the measurement in Data Monitor, so it is expected to be correct.

  • Hi Oleg,

    Have you optimized your threshold times and levels? The echo data dump can be used to help style the threshold values so that the Ultrasonic Measurement Results command reports the correct short range distance. See the video "PGA460 ultrasonic sensing: EVM GUI data monitor" for an example on using the GUI to style the threshold settings: https://training.ti.com/pga460-ultrasonic-sensing-evm-gui-data-monitor?cu=1128182 at time marker 4:47.

  • Hi Akeem,

    Previous problem was indeed related to thresholds and caused by PGA460-Q1 EVM software – it resets all the threshold setup with every board/software restart. Now it works fine. Thank you!

    However, the similar problem appears now if the ESP32 is used as master unit. UART communication is established and works fine. PGA is receiving and understanding commands, but if the process comes to measurement, PGA returns the same FF FF FF FF. Code is quite simple: EEPROM bulk write, THR bulk write, P1 burst and listen, and US measurement result return.

    For both cases (for MSP420 and ESP32) conditions were set possibly similar. Tx, Rx and power (3v3, 5v, GND) pins were connected. In both cases the identical command sequences were sent manually (EEPROM bulk write, THR bulk write, P1 burst and listen and US measurement result return). For MSP430 – through interface mode, for ESP32 – serial.write. Is there anything that could be missed?

  • Part Number: PGA460-Q1

    Working on the ultrasonic distance measurement project based on the PGA460 with ESP32 as master module. 

    If used with MSP-EXP430F5529LP as a master board (BOOSTXL-PGA460 kit), PGA460 is responding to the UART command and performs measurements with fine results (tested in PGA460-q1 EVM Interface mode through EEPROM and Threshold write commands, Burst and listen, and Return ultrasonic measurement commands). 

    In case of ESP32 as a master module, UART communication was established as well: PGA460 responds to the received commands (Bulk write & read - saves and returns correct data). However, after performing Burst and Listen, for Return Ultrasonic measurement command PGA460 returns an empty result - 44 FF FF FF FF BB (sometimes first returned byte is 40). It seem that in this case PGA460 is unable to perform any measurements. (Thresholds, as well as all other parameters (included in EEPROM and THR bulks) are identical for both cases). 

    For both masters MSP430 and ESP32, the PGA460-q1 board from BOOSTXL-PGA460 kit was tested with same connected pins: Tx, Rx and 3 power pins (5v, 3v3, Gnd). Only difference is in the Return Ultrasonic measurement command result: correct for MSP (exmpl: 40 03 E3 40 75 23) and incorrect for ESP32 (44 (or 40) FF FF FF FF (checksum accordingly)).

  • Aleksei,

    We have received your question & our application expert for PGA460 device is in vacation & we will get back with you by October 16th.

  • Oleg and Aleksei,

    Try the following debug steps:

    1. After performing the bulk threshold write command, read back the DEV_STAT1 register to check what the value of the THR_CRC_ERR bit is. It is a value of '1' at start-up, but should clear to '0' after any threshold write command.
    2. Ensure the EE_CNTRL register's DATADUMP_EN bit is '0' to allow the ultrasonic measurement results to update after the burst/listen command. It's default value is '0'.
    3. If THR_CRC_ERR and DATADUMP_EN bits are both '0', then you should probe the transducer's positive terminal to confirm the transducer is actually generating an echo. If so, then also ensure that you delay any other micro controller activity for the duration of the preset 1 or 2 record length. 100ms is always a safe delay choice to allow all ultrasonic echo activity to fully dissipate. After the delay time expires, then read back the ultrasonic measurement results. Attempting the read the ultrasonic measurement results too quickly will not allow the result values to update.
    4. If the transducer is not bursting, the only other gating item would be the VPWR_OV_THR. VPWR over voltage threshold select: 00b = 12.3 V, 01b = 17.7 V, 10b = 22.8 V, 11b = 28.3 V. If the voltage at VPWR is larger than the over voltage value, then the drivers will not toggle during a burst/listen command as a fail safe.