Stuck after matrix.begin()

Hello Community,

since this morning I am trying to marry my ESP32-S2 board together with a P5 LED Matrix, 64x32 in arduino.
In my point of view every “necessary” part in “esp32_i2s_parallel” files are changed from I2S1 to I2S0, but there is still a strange behaviour:

After calling “matrix.begin();” nothing will work anymore, this is my complete arduino code:
#include <MatrixHardware_ESP32_V0.h>
#include <SmartMatrix.h>

#define COLOR_DEPTH 24                  
const uint16_t kMatrixWidth = 64;
const uint16_t kMatrixHeight = 32;
const uint8_t kRefreshDepth = 36;
const uint8_t kDmaBufferRows = 4;
const uint8_t kPanelType = SM_PANELTYPE_HUB75_32ROW_MOD16SCAN;
const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_NONE);

SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);

const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);
SMARTMATRIX_ALLOCATE_SCROLLING_LAYER(scrollingLayer1, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kScrollingLayerOptions);

void setup()
{
  Serial.begin(115200);
  Serial.println(""); Serial.println(""); Serial.println("");
  Serial.println("*****************************************************");
  Serial.println(" HELLO !");
  Serial.println("*****************************************************");

  //matrix.addLayer(&scrollingLayer1); 
  matrix.begin();
  //matrix.setBrightness( 100 );
  
  //scrollingLayer1.setMode(wrapForward);
  //scrollingLayer1.setColor({0xff, 0xff, 0xff});
  //scrollingLayer1.setSpeed(10);
  //scrollingLayer1.setFont(gohufont11b);
  //scrollingLayer1.start("ABC", -1);
}

void loop()
{
  Serial.print("Refresh Rate: ");
  Serial.println(matrix.getRefreshRate());
  delay(1000);
}

If I uncomment “matrix.begin();” in setup-section, code in loop-function will work, otherwise not.

Any suggestions?

Thanks in advance!
BR
Markus

You might take a look at some progress here, and specifically where I mention the ISR differences:

Hi Louis,

thank you for your answer. Meanwhile I found my issue…there was one last point with I2S1:
// setup I2S Interrupt
SET_PERI_REG_BITS(I2S_INT_ENA_REG(0), I2S_OUT_EOF_INT_ENA_V, 1, I2S_OUT_EOF_INT_ENA_S);
esp_intr_alloc(ETS_I2S0_INTR_SOURCE, (int)(ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL1), i2s_isr, NULL, NULL);

Now this topic works fine, coming to the next issue…


In general I would say it works, but some columns wont displayed.
Code:
matrix.addLayer(&indexedLayer1);
matrix.addLayer(&indexedLayer2);
matrix.begin();
matrix.setBrightness( 100 );

  indexedLayer1.fillScreen(0);
  indexedLayer2.fillScreen(0);
  indexedLayer1.setFont(font8x13);
  indexedLayer2.setFont(font8x13);
  indexedLayer1.setIndexedColor(0, {0x80, 0, 0});
  indexedLayer2.setIndexedColor(1, {0, 0, 0x80});
  indexedLayer1.drawString(0, 0, 0, "Hello");
  indexedLayer2.drawString(5, 13, 0, "World");
  indexedLayer1.swapBuffers(false);
  indexedLayer2.swapBuffers(false);

Any futher ideas?

Not off the top of my head, I don’t think I’ve seen that issue before. You could try the MultiRowRefreshMapping sketch and look at the wiki for more details, but I haven’t seen panels that large that need mapping.

Two thoughts:

  • try lowering the clock speed, search the forum for how to do this
  • do you have 5V level shifters between the ESP32 and the panel? Some panels need them

Hi Louis,
thank you for your attention :wink:
At first, as LED drivers or “shift registers” on my modules are used: FM TC5020A, according to its datasheet, supply voltage area, 4,5V to 5,5V, so I set to 4,5V, why?
Input high threshold voltage is 0,7 * VCC, at 4,5V it is 3,15V…very close to 3,3V, but in specification!
My new test program is a simple pixel hopper, shift a blue pixel with ‘w’, ‘a’, ‘s’ and ‘d’ in the matrix area.
Result is very interesting!
Every second step everything is off and in between two pixels are switched on.
So the more interesting thing: It fits to the data output of I2S interface.
I my case it is not a HW issue, it seems more related to software.

I tried to half the I2C clock speed via:
#define ESP32_I2S_CLOCK_SPEED (20000000UL)
to
#define ESP32_I2S_CLOCK_SPEED (10000000UL)
but this dopples everything on my led matrix (64x32)

But pictures are somtimes more…
Pixel 0,0 should switched on:


Pixel 1,0 should switched on:

Pixel 1,1 should switched on:

Waiting excited for next ideas :wink:

Try this option:

kMatrixOptions = SM_HUB75_OPTIONS_ESP32_INVERT_CLK;

Hi Louis,
unfortunately not.
As I mentioned before, if Pixel 0,0 should switched on and nothing will happen in the LED matrix, there is also no activity on B1/B2 lines:


The second picture on my last post, if Pixel 1,0 should switched on and both LEDs are on, there is activity on B1/B2:

Ch1 1: A, Ch2: B, Ch3: C, Ch4: D, Ch5: CLK, Ch6: LAT, Ch7: B1, Ch8: B2

So for me it seems there is something wrong in software :-/

Do you have an older ESP32, one that is supported by SmartMatrix Library? I don’t know what has changed in the ESP32-S2, and don’t have any immediate plans of adding support for it to SmartMatrix Library. Without knowing if your panel works with an existing ESP32 it’s hard to debug what might be broken with the ESP32-S2.

I think a HW issue can be excluded, because this “feature” comes with all 3 colors, independently and with 3 different LED modules.
Either this issue is really related with 3,3V or an SW issue.
But its a bit strange, because, for example, in general LED 0,0 is working, but only with LED 1,0 together.

If you share your complete esp32_i2s_parallel files maybe I or someone else can try running them on an otherwise working ESP32 and see if they work

Yes sir! ;-)… have no idea how to post c or h files, because these are no images :smiley: But I hope this works also.

Next time you could use gist.GitHub.com. Usually it works to paste the content of files here but for some reason a lot of quote characters were converted to the wrong type. I had to revert some of the changes you made to get it to compile, and then found it doesn’t work on my ESP32. I tried switching to use I2S0 from I2S1 from scratch, and couldn’t get it to work with the time I had to try. I didn’t get a valid image to display, but think I found one source of problem:

All the code that looks like this is hardcoded assuming that we use I2S1:

I2S0 doesn’t need the bytes loaded in a weird order like I2S1 does:

So for a quick fix, try removing the +1 / -1 sections from the code, from the else section, as you’re using I2S_PARALLEL_BITS_16 not I2S_PARALLEL_BITS_8. It will be more complicated to make the code work on either I2S0/I2S1.

If you can share all the files you changed in a GitHub Gist, or by forking SmartMatrix Library and committing to your own branch, that would be helpful for me trying to add I2S0 support, and hopefully eventually ESP32-S2 support to SmartMatrix Library

Edit: the above +1/-1 advice may be incorrect, worth a shot though.

My past self seems to have some advice:

https://www.esp32.com/viewtopic.php?f=17&t=3188&p=22399&hilit=i2s0&sid=77fcbfa5da56897717baf57a8b603814#p22399

I haven’t tried this yet

This changes is necessary for I2S0 too, I already implemented this “feature”, but the best result is shown in post #3.
To go deeper in this issue I created a jerk in my repository, because I dont have access to yours.

There is a branch “ESP32-S2” with all my changes.

Changes in “MatrixEsp32Hub75Calc_Impl.h” by removing any +/- calculations wont affect the result unfortunately.

Are there any updates or new ideas about this topic?

I haven’t had time to try your changes yet