SUMP Compatible ESP32 Logic Analyzer with RLE

User avatar
E.U.A.
Posts: 18
Joined: Wed Feb 05, 2020 2:24 am

SUMP Compatible ESP32 Logic Analyzer with RLE

Postby E.U.A. » Wed Feb 05, 2020 2:35 am

Hello.

I just published my code on github.

It's ESP32 Logic Analyzer which is SUMP compatible 16Bit captures up to 20Mhz using I2S DMA.
I am able to see 20 Mbps UART communication with it using PulseView/Sigrok.

Unfortunately my device is not WROOVER one which has much more RAM on it.
If you not willing to send me one, current code has only capture up to 128K sample using 256Kbyte of memory for buffer.

Well it does NOT support analog input.

Project page: https://github.com/EUA/ESP32_LogicAnalyzer
Image
Last edited by E.U.A. on Fri Mar 06, 2020 2:38 pm, edited 1 time in total.
Admin of the SamyGO.tv, Samsung TV Hacking Project

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: SUMP Compatible ESP32 Logic Analyzer

Postby ESP_igrr » Wed Feb 05, 2020 3:02 pm

Hi E.U.A., this is an awesome project!

If you send me a PM with your postal address and phone number, we'll send you a development kit with a WROVER module and Ethernet.

User avatar
E.U.A.
Posts: 18
Joined: Wed Feb 05, 2020 2:24 am

Re: SUMP Compatible ESP32 Logic Analyzer

Postby E.U.A. » Wed Feb 05, 2020 3:31 pm

Ah thank you! :D
Than I will use extra ram buffer to expand sampling on it.
I will send PM about it.

I am little sad about sampling speed which is limited to 20Msps.

I found that If I use QSPI interface, I can sample up to 80Msps 4bit but I am not sure if it supports such a long RX reception.
But found that Arduino-esp32 don't support QSPI DMA, yet.
Otherwise I plan to use Dual QSPI with DMA to archive 80Msps 8Bit device implementation.
If I found such a some sample, will try to implement it also.
Thanks!
Admin of the SamyGO.tv, Samsung TV Hacking Project

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: SUMP Compatible ESP32 Logic Analyzer

Postby chegewara » Wed Feb 05, 2020 6:27 pm

BIG (+) espressif for action/reaction.

mikronauts
Posts: 23
Joined: Wed Dec 09, 2015 8:11 pm

Re: SUMP Compatible ESP32 Logic Analyzer

Postby mikronauts » Wed Feb 05, 2020 8:53 pm

Excellent work!

You must be sampling faster than 20Mhz to see a 20Mbps uart...
E.U.A. wrote:
Wed Feb 05, 2020 2:35 am
Hello.

I just published my code on github.

It's ESP32 Logic Analyzer which is SUMP compatible 16Bit captures up to 20Mhz using I2S DMA.
I am able to see 20 Mbps UART communication with it using PulseView/Sigrok.

Unfortunately my device is not WROOVER one which has much more RAM on it.
If you not willing to send me one, current code has only capture up to 128K sample using 256Kbyte of memory for buffer.

Well it does NOT support analog input.

Project page: https://github.com/EUA/ESP32_LogicAnalyzer
Image

User avatar
E.U.A.
Posts: 18
Joined: Wed Feb 05, 2020 2:24 am

Re: SUMP Compatible ESP32 Logic Analyzer

Postby E.U.A. » Wed Feb 05, 2020 9:59 pm

mikronauts wrote:
Wed Feb 05, 2020 8:53 pm
Excellent work!

You must be sampling faster than 20Mhz to see a 20Mbps uart...
Thank you.

Yes, If you are working on analog signals, you are correct. You need sample at least 4 times faster than signal you gonna analyze for proper sampling.

But if you are gonna sample digital signals... Nope. You can sample at (exactly) same speed.

If two sampling clocks are exactly in same speed, they will be synchronized and you can analyze/capture the transmission.

But if there is a slight de synchronization, result is not looks like what you expect.

Since I sampling using DMA and clock generated by ESP32's hardware and is exactly 20Mhz (and minimal jitter on it), I could read precise 20Mbaud digital transmissions. And ESP8266 send TX burst via Hardware (again, no jitter and in exact 20Mhz clock), viola!

At top, 10Mbaud signal, at bottom 20Msps one. On 20Msps UART signal, there are some minor errors on stopbits section but transmission captured value is correct.

And here is the ESP8266 code which I generate signal from,
DIY and see if you could.
  1. #include "sigma_delta.h"
  2.  
  3. #include <ESP8266WiFi.h>
  4. #include <ArduinoOTA.h>
  5. #include <WiFiManager.h>
  6.  
  7. const char* host_name = "esp8266-TestSignal";
  8.  
  9. //#define SignalBaud 2304000  // 2M baud!
  10. //#define SignalBaud 4000000 // 4M baud!
  11. //#define SignalBaud 4608000 // 4M baud!
  12. //#define SignalBaud 8000000   // 8M baud!
  13. #define SignalBaud1 10000000   // 10M baud!
  14. //#define SignalBaud 16000000 // 16M baud!
  15. #define SignalBaud2 20000000   // 10M baud!
  16.  
  17. #define SignalFreq 1000000  //1M
  18. //#define SignalFreq 2000000  //2M
  19. //#define SignalFreq 10000000 //10M
  20. //#define SignalFreq 20000000 //20M
  21.  
  22. byte xbyte;
  23. void setup() {
  24.   Serial.begin(115200);
  25.   Serial1.begin(SignalBaud1);// 8M baud!
  26.  
  27.   Serial.println("\r\n\r\n\r\n");
  28.   Serial.println("ESP8266 TestSignal");
  29.   Serial.println("Connecting...");
  30.  
  31.   WiFi.mode(WIFI_STA);
  32.   WiFiManager wifiManager;
  33.   wifiManager.setConfigPortalTimeout(600);
  34.   if (!wifiManager.autoConnect()) {
  35.     Serial.println("failed to connect and hit timeout");
  36.     //reset and try again.
  37.     ESP.reset();
  38.     delay(1000);
  39.   }
  40.  
  41.   WiFi.hostname( host_name );
  42.   WiFi.setSleepMode( WIFI_LIGHT_SLEEP );
  43.  
  44.   Serial.println("");
  45.   Serial.println("WiFi connected");
  46.   Serial.println("IP address: ");
  47.   Serial.println(WiFi.localIP());
  48.  
  49.   ArduinoOTA.setHostname(host_name);
  50.   ArduinoOTA.begin();
  51.  
  52.   //Serial.println("Turn of built in LED.");
  53.   //digitalWrite(BUILTIN_LED, HIGH);//Turn off led
  54.   pinMode(4, OUTPUT);
  55.  
  56.   uint32_t SigmaDeltaPin = D6;
  57.   int prescaler = 8;
  58.   int SigmaDeltaChannel = 0;
  59.   int freq = sigmaDeltaSetup(0, SignalFreq);
  60.   prescaler = 80000000/SignalFreq;
  61.   sigmaDeltaAttachPin(SigmaDeltaPin); // D6
  62.   //sigmaDeltaWrite(SigmaDeltaChannel, 1);
  63.   sigmaDeltaWrite(SigmaDeltaChannel, 125);
  64.   sigmaDeltaSetPrescaler(prescaler); // 80Mhz / prescaler
  65.   Serial.printf("\n\n\nSigmaDelta PWM working on port D6 with Freq of %0.2f Mhz\r\n", SignalFreq/1000000.0);
  66.   Serial.println("Starting Test signal on Serial1 (D4)");
  67.   Serial.println("Setting GPIO4 HIGH while sending.");
  68.   Serial.printf("SignalBaud from Serial1 TXD using %d baud\r\n", SignalBaud1 );
  69.   Serial.printf("SignalBaud from Serial  TXD using %d baud\r\n", SignalBaud2 );
  70.   Serial.println("Closing terminal.");
  71.   Serial.flush();
  72.   Serial.end();
  73.   xbyte=0;
  74.   Serial.begin(SignalBaud2);
  75. }
  76.  
  77. uint32_t w=0;
  78. void loop() {
  79.   if((w++%100)==0)        //To reduce wait between samples.
  80.     ArduinoOTA.handle();
  81.   digitalWrite(4, HIGH );
  82.   Serial1.write(xbyte);
  83.   Serial.write(xbyte++);
  84.   digitalWrite(4, LOW );
  85. }
Admin of the SamyGO.tv, Samsung TV Hacking Project

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: SUMP Compatible ESP32 Logic Analyzer

Postby jgustavoam » Sun Feb 09, 2020 4:04 pm

Congratulations EUA !
I and my friend Rui Viana are studying to develop the same project!
And you won! I will test your project and then post my results.

I made one recent progress - I set I2S master clock up to 80 MHz (tested) ! Awesome.
I2S BCK is derived from the master clock.

viewtopic.php?f=18&p=55305#p55305

Thanks a lot!
Gustavo Murta
Last edited by jgustavoam on Sun Feb 09, 2020 4:07 pm, edited 1 time in total.
Retired IBM Brasil
Electronic hobbyist since 1976.

User avatar
E.U.A.
Posts: 18
Joined: Wed Feb 05, 2020 2:24 am

Re: SUMP Compatible ESP32 Logic Analyzer

Postby E.U.A. » Sun Feb 09, 2020 4:06 pm

While I am working on real-time (20Mhz) RLE encoder code...
I want to ask something,

for

Code: Select all

I2S0.fifo_conf.rx_fifo_mod = 1;// SM_0A0B_0C0D = 1,
I expect I2S DMA samples in order of 00 s1 00 s2, 00 s3 00 s4, ...

But when I reach the dma buffer via pointer, and read it byte by byte, It looks like: 00 s2 00 s1, 00 s4 00 s3, ...

Why?

Does it related with endianess?

I coded as dma element union as:

Code: Select all

typedef union {
    struct {
        uint8_t sample2;
        uint8_t unused2;
        uint8_t sample1;
        uint8_t unused1;
      };
    struct{
      uint16_t val2;
      uint16_t val1;
      };
    uint32_t val;
} dma_elem_t;
As you see, first, sample 2 at top. But I expect it need to be like:

Code: Select all

        uint8_t unused1;
        uint8_t sample1;
        uint8_t unused2;
        uint8_t sample2;
Well, it doesn't so big problem but I am racing with clocks and I just have 12 clock to encode each sample...
If there are some quick fix for that, I will be happy.
Thanks.
Last edited by E.U.A. on Sun Feb 09, 2020 5:00 pm, edited 1 time in total.
Admin of the SamyGO.tv, Samsung TV Hacking Project

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: SUMP Compatible ESP32 Logic Analyzer

Postby jgustavoam » Sun Feb 09, 2020 4:09 pm

Hi EUA,

Did you see this code ?
esp32-camera/driver/camera.c
https://github.com/espressif/esp32-came ... r/camera.c

https://github.com/espressif/esp32-came ... a_common.h

How FIFO sends or receives Bytes?

Code: Select all

typedef enum {
    /* camera sends byte sequence: s1, s2, s3, s4, ...
     * fifo receives: 00 s1 00 s2, 00 s2 00 s3, 00 s3 00 s4, ...
     */
    SM_0A0B_0B0C = 0,
    /* camera sends byte sequence: s1, s2, s3, s4, ...
     * fifo receives: 00 s1 00 s2, 00 s3 00 s4, ...
     */
    SM_0A0B_0C0D = 1,
    /* camera sends byte sequence: s1, s2, s3, s4, ...
     * fifo receives: 00 s1 00 00, 00 s2 00 00, 00 s3 00 00, ...
     */
    SM_0A00_0B00 = 3,
} i2s_sampling_mode_t;
Retired IBM Brasil
Electronic hobbyist since 1976.

User avatar
E.U.A.
Posts: 18
Joined: Wed Feb 05, 2020 2:24 am

Re: SUMP Compatible ESP32 Logic Analyzer

Postby E.U.A. » Sun Feb 09, 2020 4:15 pm

Hi jgustavoam,
It's possible to clock I2S up to 80Mhz but the point is, does it support SLAVE mode?

Since we are reading (RX) from I2S, ESP32 expect external clock not use internal derived one.
I pass this requirement via feeding a pin via generated external clock signal and routing to I2S clk pin. But after 20Mhz, it doesn't work proper.

If there is a way to make I2S slave mode using internal clock, I easy implement it to code and support up to 80, or at least 40Mhz...
jgustavoam wrote:
Sun Feb 09, 2020 4:04 pm
Congratulations EUA !
I and my friend Rui Viana are studying to develop the same project!
And you won! I will test your project and then post my results.

I made one recent progress - I set I2S master clock up to 80 MHz (tested) ! Awesome.
I2S BCK is derived from the master clock.

viewtopic.php?f=18&p=55305#p55305

Thanks a lot!
Gustavo Murta
Admin of the SamyGO.tv, Samsung TV Hacking Project

Who is online

Users browsing this forum: No registered users and 129 guests