Skip to main content
Fixed typo. Made text bold.
Source Link
sa_leinad
  • 3.2k
  • 2
  • 24
  • 53

You have likely run out of RAM.

The following use up large chunks of your SRAM:

  • pixls array = 1600 bytes
  • Serial = 170 bytes
  • DMD > 64 bytes

This is in addition to all your other variables and function calls.

The problem is that the compiler promotes boolean variables to bytes. So where you need 1600 pixels it takes 1600 bytes. Alternatively, you could pack 8 pixels into that byte. This method would only consume 200 bytes instead of 1600.

Also, I don't understand why you have a 16 by 100 array. From the code I can see that you are using a single DMD which has 32 pixels wide by 16 pixels high. Why send/buffer more pixels than needed? A single DMD would only need an array of 64 bytes.

The Arduino Uno only has 2KB of SRAM.

Solutions:

  1. I suggest sending the ASCII text to the Arduino and then letting the font library within SoftDMD convert it to pixels. That is why you are using the DMD2 library.I suggest sending the ASCII text to the Arduino and then letting the font library within SoftDMD convert it to pixels. That is why you are using the DMD2 library.

However if you want to stick to the approach you have taken:

  1. Pack 8 pixels into every byte in the array. This will save 1400 bytes of precious SRAM.

  2. Only send one DMD workword of data at a time. This will save 1536 bytes of precious SRAM.

  3. You could use an Arduino with a greater amount of SRAM.

  • Arduino Mega - 8KB SRAM
  • Arduino ZERO - 32KB SRAM
  • Arduino Due - 96KB SRAM
  • Arduino MKR 1000/1010/1400/ZERO - 32KB SRAM

You have likely run out of RAM.

The following use up large chunks of your SRAM:

  • pixls array = 1600 bytes
  • Serial = 170 bytes
  • DMD > 64 bytes

This is in addition to all your other variables and function calls.

The problem is that the compiler promotes boolean variables to bytes. So where you need 1600 pixels it takes 1600 bytes. Alternatively, you could pack 8 pixels into that byte. This method would only consume 200 bytes instead of 1600.

Also, I don't understand why you have a 16 by 100 array. From the code I can see that you are using a single DMD which has 32 pixels wide by 16 pixels high. Why send/buffer more pixels than needed? A single DMD would only need an array of 64 bytes.

The Arduino Uno only has 2KB of SRAM.

Solutions:

  1. I suggest sending the ASCII text to the Arduino and then letting the font library within SoftDMD convert it to pixels. That is why you are using the DMD2 library.

However if you want to stick to the approach you have taken:

  1. Pack 8 pixels into every byte in the array. This will save 1400 bytes of precious SRAM.

  2. Only send one DMD work of data at a time. This will save 1536 bytes of precious SRAM.

  3. You could use an Arduino with a greater amount of SRAM.

  • Arduino Mega - 8KB SRAM
  • Arduino ZERO - 32KB SRAM
  • Arduino Due - 96KB SRAM
  • Arduino MKR 1000/1010/1400/ZERO - 32KB SRAM

You have likely run out of RAM.

The following use up large chunks of your SRAM:

  • pixls array = 1600 bytes
  • Serial = 170 bytes
  • DMD > 64 bytes

This is in addition to all your other variables and function calls.

The problem is that the compiler promotes boolean variables to bytes. So where you need 1600 pixels it takes 1600 bytes. Alternatively, you could pack 8 pixels into that byte. This method would only consume 200 bytes instead of 1600.

Also, I don't understand why you have a 16 by 100 array. From the code I can see that you are using a single DMD which has 32 pixels wide by 16 pixels high. Why send/buffer more pixels than needed? A single DMD would only need an array of 64 bytes.

The Arduino Uno only has 2KB of SRAM.

Solutions:

  1. I suggest sending the ASCII text to the Arduino and then letting the font library within SoftDMD convert it to pixels. That is why you are using the DMD2 library.

However if you want to stick to the approach you have taken:

  1. Pack 8 pixels into every byte in the array. This will save 1400 bytes of precious SRAM.

  2. Only send one DMD word of data at a time. This will save 1536 bytes of precious SRAM.

  3. You could use an Arduino with a greater amount of SRAM.

  • Arduino Mega - 8KB SRAM
  • Arduino ZERO - 32KB SRAM
  • Arduino Due - 96KB SRAM
  • Arduino MKR 1000/1010/1400/ZERO - 32KB SRAM
Source Link
sa_leinad
  • 3.2k
  • 2
  • 24
  • 53

You have likely run out of RAM.

The following use up large chunks of your SRAM:

  • pixls array = 1600 bytes
  • Serial = 170 bytes
  • DMD > 64 bytes

This is in addition to all your other variables and function calls.

The problem is that the compiler promotes boolean variables to bytes. So where you need 1600 pixels it takes 1600 bytes. Alternatively, you could pack 8 pixels into that byte. This method would only consume 200 bytes instead of 1600.

Also, I don't understand why you have a 16 by 100 array. From the code I can see that you are using a single DMD which has 32 pixels wide by 16 pixels high. Why send/buffer more pixels than needed? A single DMD would only need an array of 64 bytes.

The Arduino Uno only has 2KB of SRAM.

Solutions:

  1. I suggest sending the ASCII text to the Arduino and then letting the font library within SoftDMD convert it to pixels. That is why you are using the DMD2 library.

However if you want to stick to the approach you have taken:

  1. Pack 8 pixels into every byte in the array. This will save 1400 bytes of precious SRAM.

  2. Only send one DMD work of data at a time. This will save 1536 bytes of precious SRAM.

  3. You could use an Arduino with a greater amount of SRAM.

  • Arduino Mega - 8KB SRAM
  • Arduino ZERO - 32KB SRAM
  • Arduino Due - 96KB SRAM
  • Arduino MKR 1000/1010/1400/ZERO - 32KB SRAM