Go Down

Topic: LED matrix display - MD_Parola, MD_MAX72xx and MD_MAXPanel (Read 451719 times) previous topic - next topic

Nealix

Thanks. A short term fix is to simply cast the pointer.

The WEMOS compiler settings seem to cause this problem a lot.
Hi Marco:

I am new at this, can you provide an example or more description for
"casting the pointer"?

Cheers,

Neal

Nealix

Hi Marco,

-I use 5V 40A Power Supply for the modules, and usb power for the arduino. I connected the ground between those two.

-I connected the last module of row 1 to the first of row 2 (the square module type), just like :

https://arduinoplusplus.wordpress.com/2017/03/15/parola-a-to-z-double-height-displays/

-I switch the modules many times, and the error is unpredictable. I try to ligth up each 4in1 modules, work perfectly fine.

attached the double height v1 test.
I use arduino Mega, CS = 53 , Din = 51, CLK = 52.

pls help
Thank you

Hi Plekotho:

I am fairly new at this, but I am using with good success two rows of 12 modules.
Can you provide some pictures of the back side of your 8x8 matrix modules,
perhaps even one with the LED Matrix unplugged so we can see the chip and board?

I purchased the 4-in-1 matrix modules, same FC16 hardware, from ebay.  Electrically
identical to your single 8x8 modules but 4 joined together.   I found they were completely
lacking required DC (Vcc) bypass and filter capacitors.  So once I strung more than about
4 or 5 together, electrical switching noise would corrupt the matrix display.
I added a 0.1 microfarad ceramic capacitor and a 22 microfarad electrolytic capacitor to
each of the Max7219 chips power and ground.   I also ran a separate jumper wire from my
power supply to each set of 4 modules so there would not be voltage drop from too many modules
in series (for the 5 volt line).    This completely solved any issues for me.
Some photos of the chip side of your module boards would be worth a thousand words.

Cheers,

Neal

marco_c

My only other suggestion at this stage is to build up the number of devices gradually. Start with just one height display of 2, 4, 6 etc unts and see if the issue happens. Then do the same with double height units. At some point it will start to misbehave and this may give you a clue.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

marco_c

For those interested - a font editor that runs in your web browser. Thread here http://forum.arduino.cc/index.php?topic=577999.0
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

ericBcreator

Hi Marco, I already told you but again: a great job on the library!

Unfortunately, I am running into a problem with the UTF-8 example for my latest project. It's over here if you're interested.
I'm using an ESP32 DEVKIT V1 (board ESP32 Dev Module).

When I try the example code I keep getting a LoadStoreError:

[Parola UTF-8 display Test]
Converting: abcABC
Converted 0x61 to 0x61Guru Meditation Error of type LoadStoreError occurred on core  1. Exception was unhandled.
Register dump:
PC      : 0x400d09d3  PS      : 0x00060730  A0      : 0x800d0a17  A1      : 0x3ffcf220 
A2      : 0x3f400f40  A3      : 0x3f400f3f  A4      : 0x0800001c  A5      : 0x00000003 
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x800d09d0  A9      : 0x3ffcf200 
A10     : 0x00000061  A11     : 0x00000061  A12     : 0x3ffc2548  A13     : 0x00000003 
A14     : 0x00000001  A15     : 0x00000000  SAR     : 0x0000001f  EXCCAUSE: 0x00000003 
EXCVADDR: 0x3f400f3f  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff 

Backtrace: 0x400d09d3:0x3ffcf220 0x400d0a14:0x3ffcf240 0x400e384f:0x3ffcf260

Rebooting...


I traced the problem down to these 2 lines:

110 *cp++ = c;
112 *cp = '\0';   // terminate the new string

If I comment them out I don't get any errors (but also no conversion...) as the writing of it seems to cause the error.

Any idea how to solve this?



Thanks, Eric

marco_c

Can you try changing this part of the code
Code: [Select]
char *pc[] =
{
  "abcABC",
  "äöüßÄÖÜ",
  "50€/kg³",
  "Español",
  "30m/s²",
  "Français",
  "20µs/°C",
};

to something like this and see if it makes a difference
Code: [Select]
char *pc[] =
{
  "abcABC\0\0\0\0\0\0\0\0\0\0\0\0",
  "äöüßÄÖÜ\0\0\0\0\0\0\0\0\0\0\0\0",
  "50€/kg³\0\0\0\0\0\0\0\0\0\0\0\0",
  "Español\0\0\0\0\0\0\0\0\0\0\0\0",
  "30m/s²\0\0\0\0\0\0\0\0\0\0\0\0",
  "Français\0\0\0\0\0\0\0\0\0\0\0\0",
  "20µs/°C\0\0\0\0\0\0\0\0\0\0\0\0",
};
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

ericBcreator

Hi Marco, thanks for your reply. Unfortunately, adding the null characters made no difference.

However, I did get the code to work by adding a temporary buffer and returning it:

String utf8AsciiStr(char* s)
// Conversion of the UTF-8 string to Extended ASCII
{
  uint8_t c, k = 0;
  char tmpBuffer[] = "";
 
  PRINT("\nConverting: ", s);

  while (*s != '\0')
  {
    c = utf8Ascii(*s++);
    if (c != '\0') {
      tmpBuffer[k++] = c;
    }
  }
  tmpBuffer[k] = '\0';
  return(tmpBuffer);
}


My experience with C and Arduino is limited and I believe String variables are not preferred (?) but it does work.
Apparently the direct writing to the string to be converted kept crashing the ESP32. Maybe a bug in its Arduino library?

Hi,

I see two problems with that code.

a) You are defining tmpBuffer inside a function and returning a pointer, being a local variable when the function ends that variable is not valid anymore.
b) You are not allocating any space with char tmpBuffer[] = ""; (well, maybe 1 byte), so, writing to that var can overwrite something important.


You might get away with this kind of thing on an Arduino as not much more is going on apart from your code.
On an ESP32 being it multi core things might be different and a crash is to be expected.


Try to define the variable as a global var, outside any function and allocate some space to it, something like char tmpBuffer[64]="";
--
You never learn anything by doing it right.

ericBcreator

Hi Marco,

Thanks, 2 valid comments - those could lead to hard to debug issues later...

I'll define the buffer globally, making sure it fits the string to be converted.

Thanks!



Eric

marco_c

It wasn't me but I was going to point out the same.

I really cannot understand why the original code would not work. The converted is ALWAYS shorter than the  original, so there should never be a buffer overflow. Does anyone else know something different?
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

ericBcreator

Oops, sorry ocsav, I wasn't paying attention there...

The error with the ESP32 is not a buffer overflow, as far as my experiments turned out.
It happens the 1st time line 110 *cp++ = c; is executed.

borzov161

Hi Marco.
 I like examples : Parola_UFT-8_Display and Parola_Double_Height_v1.
But they weigh a lot
"Sketch uses 24134 bytes (78%) of program storage space. Maximum is 30720 bytes.
Global variables use 449 bytes (21%) of dynamic memory, leaving 1599 bytes for local variables"
and
"Sketch uses 24112 bytes (78%) of program storage space. Maximum is 30720 bytes.
Global variables use 650 bytes (31%) of dynamic memory, leaving 1398 bytes for local variables."

How can they be reduced. how to cut out unused effects?
The 3.0.1 library grew by 5,000 bytes after the 2.6.0 library .
My old sketch doesn't fit. Not enough memory.
Sorry, the translation of technical.

Oops, sorry ocsav, I wasn't paying attention there...

The error with the ESP32 is not a buffer overflow, as far as my experiments turned out.
It happens the 1st time line 110 *cp++ = c; is executed.
I have to admit that C pointer arithmetic is way over my head.
I had that kind of problems with the ESP2266 (never tried the ESP32) in the past even without doing funny stuff with pointers, the problem went away by moving some initialization code into a function, never knew what the problem was. But I do think that in your case it is some type of buffer overflow, probably 'cp' is not pointing to where you think it is.
Try to break line 110 in two, *cp = c ; hmmm here I'm not sure if it should be *cp++ or cp++... dammed pointers... sorry.
--
You never learn anything by doing it right.

marco_c

@borzov
The libraries are bigger because the code that was ifdef'ed out is now all there once the selection for board type is part of code and not edited header file. It seems that many many users were not able to cope or understand how to edit a header file. My tech support questions have dropped by more than 90% since the change.

There are a number of things that you can do to optimise Flash RAM. Please see this blog article https://arduinoplusplus.wordpress.com/2018/09/23/parola-a-to-z-optimizing-flash-memory/

@ericBcreator, ocsav
That line of code is legitimate and should not be causing issues. If you want to split it use
Code: [Select]
*cp = c;
cp++;
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

borzov161

#1394
Nov 11, 2018, 02:29 pm Last Edit: Nov 11, 2018, 02:38 pm by borzov161
 Marco many thanks.
It worked. Not knowing English is my problem.
Description of large, I not all translated on Russian language.
You're a genius.
thank you so much for the link and your explanation.

Go Up