Hi jgustavoam,
I still don't understand why I can't use Serial1 .
Okay. Than you will clearly understand why.
The reason is, generally, ESP32 development boards, at least that I have, has USB-to-TTL UART chip on the board that DTR line connected to reset pin of the module. Means, when you try to open com port, it resets due DTR signal switching. And when module resets, it need to boot and write some debug messages to terminal, (AFAIK there are no way to avoid them) like
Code: Select all
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x16 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
...
Okay, what is the problem with that? Problem is
libsigrok doesn't clear RX buffer when it try to scan device on serial line. For scan ols device, it just send "0x00" for 5 times than try to read 4 bytes and expect string like ALS1... But instead reads "ets " at first run for example since it's available on RX buffer... And continuous sending is doesn't solve the issue since ALS1 answer become "1ALS" due there are 2x remaining byte on RX buffer every time... My patch is just flushes RX buffer before scan...
Thanks for the suggestions. I thought on it. It looks like code is trying to capture for 40Mhz. But its really capture at 20Mhz. How do I know it? I count CPU clock between DMA samples and It's accurate for 20Mhz. Sigrok acts like if sampling clock is 20Mhz. Also 20Mbps UART signal spikes minimum width are just on 1 dot width instead of 2. All I can say that: it's working.