使用ESP32读取数字硅麦的数据

Posted 卓晴

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用ESP32读取数字硅麦的数据相关的知识,希望对你有一定的参考价值。

测试硅麦的输出数据

 

01 字硅麦


一、背景介绍

  手边的这个数字硅麦, 是来自Infineon提供的样品, 它的接口是PDM输出。 在前面已经对该传感器进行过初步的测试。 现在使用ESP32平台来读取该它的输出信号。 根据测试,硅麦要求时钟信号大于400kHz, 利用ESP32的SPI接口可以输出超过这个频率的时钟信号, 同时可以读入相应的数据。

二、ESP32输入输出

1、测试SPI脉冲

  根据 WS2812串行可控彩色LED灯珠 中的测试程序。 编写SPI基本测试脉冲程序。 通过管脚14输出时钟信号, 时钟频率为2.5MHz。 这是测量ESP32第12管脚输出波形, 可以看到对应的周期为400ns,频率为2.5MHz。

from machine                import Pin,Timer,SPI
import time

hspi = SPI(1, 2500000, sck=Pin(14), 
           mosi=Pin(13), miso=Pin(12), polarity=0)

outbyte = bytes([0xff]*16)

print("Test.")
while True:
    hspi.write(outbyte)
    time.sleep_ms(10)

▲ 图1.2.1 SPI管脚分布

  下面将SPI 输出频率修改成500KHz,  输入输出2000个字节。 这是测量硅麦PDM输出波形。 下面看看其中脉冲结构。 前面1ms是芯片启动。 这部分是内部稳定时输出信号 这里可以看到输出带有信号的波形。 

from machine                import Pin,Timer,SPI
import time

hspi = SPI(1, 500000, sck=Pin(14),
           mosi=Pin(13), miso=Pin(12), polarity=0)

print("Test.")
while True:
    readb = hspi.read(2048)
    time.sleep_ms(1)
    break

print(readb)
b"\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfdUUUUUUUUUUUUUUUUUUUU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x1c\\xb2\\xca\\xad*\\xcb*\\xcb*\\xcb+*\\xcb+*\\xcb*\\xcc\\xaa\\xb4\\xac\\xab+,\\xca\\xabJ\\xcc\\xaa\\xd2\\xad+,\\xb2\\xcbJ\\xadK+3,\\xb5*\\xcd2\\xd2\\xcc\\xcc\\xb5J\\xb4\\xd4\\xb4\\xb3T\\xadM-M-S3T\\xb5R\\xd4\\xd5-U3T\\xce55M64\\xd5MScST\\xe3b\\xe3b\\xe4\\xd5USU\\x8bY64\\xe56656T\\xd5\\x8dS\\x93d\\xd59SX\\xd3\\x93Ub\\xd5UMU5UK\\x8dU.L\\xe35SMK\\x8d3T\\xcd3M4\\xcd-4\\xb3R\\xb3L\\xb4\\xad,\\xcb2\\xad2\\xac\\xb2\\xb3\\x1c\\xca\\xabF\\xca\\xb2r\\xac\\x9b*\\xaa\\xa9\\xcb\\x17)\\xb1\\xaarjk\\x19\\xa9\\xaa\\xa9\\\\\\x99\\xaai\\x9ai\\xa6\\x99\\x99\\xa9\\x96\\x99\\xa5je\\x99\\x96\\x99\\x95\\x9aV\\x99V\\x96fUjY:\\x95iU\\xa6UfeYfU\\xa4\\xea:N\\xa5Ve\\x95\\x99YfU\\xa5fVfU\\xa6U\\xa6Yfe\\x99iffe\\xa5\\xa6Zif\\x96\\xa6fjff\\xaaV\\xc5q\\xa6\\x9aj\\xa6j\\x9a\\xa9\\xa6\\xaa"


■ 相关文献链接:

● 相关图表链接:

以上是关于使用ESP32读取数字硅麦的数据的主要内容,如果未能解决你的问题,请参考以下文章

硅麦的输出阻抗测量

英飞凌硅麦可以接收到超声波吗?

英飞凌硅麦可以接收到超声波吗?

英飞凌的模拟硅麦

硅麦音频放大器

ESP32/ESP8266自动下载电路波形,ESP32/ESP8266不能UART流控自动下载的解决方法