Part Number:PGA460
这是代码
pga460 ussc;
byte edd = 2; // echo data dump of preset 1, 2, or neither
byte echoDataDumpElement = 0; // echo data dump element 0 to 127
void setup() {
// put your setup code here, to run once:
initPGA460();
}
void initPGA460()
{
int inByte=0;
Serial.begin(9600);
delay(1000);
ussc.initBoostXLPGA460(0, 9600, 0);
ussc.registerWrite(0x14, 0xAF);
ussc.registerWrite(0x15, 0xFF);
ussc.registerWrite(0x16, 0xFF);
ussc.registerWrite(0x17, 0x2D);
ussc.registerWrite(0x18, 0x68);
ussc.registerWrite(0x19, 0x36);
ussc.registerWrite(0x1A, 0xFC); ussc.registerWrite(0x1B, 0x31);
ussc.registerWrite(0x1C, 0x8C);
ussc.registerWrite(0x1D, 0x00); ussc.registerWrite(0x1E, 0x01);
ussc.registerWrite(0x1F, 0x12); Serial.print("TVGAIN0:");
Serial.print(ussc.registerRead(0x14),HEX);
Serial.print("\nTVGAIN1:");
Serial.print(ussc.registerRead(0x15),HEX);
Serial.print("\nTVGAIN2:");
Serial.print(ussc.registerRead(0x16),HEX);
Serial.print("\nTVGAIN3:");
Serial.print(ussc.registerRead(0x17),HEX);
Serial.print("\nTVGAIN4:");
Serial.print(ussc.registerRead(0x18),HEX);
Serial.print("\nTVGAIN5:");
Serial.print(ussc.registerRead(0x19),HEX);
Serial.print("\nTVGAIN6:");
Serial.print(ussc.registerRead(0x1A),HEX);
Serial.print("\nINIT_GAIN:");
Serial.print(ussc.registerRead(0x1B),HEX); Serial.print("\nFREQUENCY:"); Serial.print(ussc.registerRead(0x1C),HEX); Serial.print("\nDEADTIME:");if (edd != 0) // run or skip echo data dump
{
Serial.println("Retrieving echo data dump profile. Wait…");
ussc.runEchoDataDump(edd-1); // run preset 1 or 2 burst and/or listen command
for(int n=0; n<128; n++) // get all echo data dump results
{
echoDataDumpElement = ussc.pullEchoDataDump(n);
Serial.print(echoDataDumpElement);
Serial.print(",");
}
}
}
这是串口返回的
TVGAIN0:FF
TVGAIN1:FF
TVGAIN2:FF
TVGAIN3:FF
TVGAIN4:FF
TVGAIN5:FF
TVGAIN6:FF
INIT_GAIN:FF
FREQUENCY:FF
DEADTIME:
Retr
ieving echo data dump profile. Wait…
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
Amy Luo:
您好,
您是否按照数据表 图 43.将PGA460 配置为UART通信?
您是否可以按照7.5.1通信示例正确读写寄存器?
,
user6477655:
PGA460.zip我用的软件包,这不是可以进行UART通信的吗
,
Amy Luo:
您是否在您的代码中调通了上面功能?
,
user6477655:
这代码应该是没问提的,我用的听别人调试过的
,
Amy Luo:
下面链接的问题与您的问题有些类似,请查看下链接中工程师的回复:
https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_传感器_pga460-q1-usart-communication-on-pga460-q1
,
user6477655:
请问你有没有关于PGA460的UART通信的代码
,
Amy Luo:
下面开发资源希望对您有帮助,其中,软件开发指南中有一些代码:
PGA460 Software Development Guide:https://www.ti.com.cn/cn/lit/an/slaa730a/slaa730a.pdf
PGA460 EVM Training:https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_传感器_pga460-ultrasonic-sensing-how-set-and-install-evm
FAQ:https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/640810/pga460-everything-you-need-to-know-for-ultrasonic-tof-air-coupled-collateral-tools-designs