board707 / DMD_STM32

STM32Duino library for RGB, Monochrome and Two-color led matrix panels
GNU General Public License v3.0
64 stars 21 forks source link

P2.5 (128x64) RGB Panel with stm32F103RCT6 and stm32F411CE test results #111

Open digi55 opened 4 months ago

digi55 commented 4 months ago

Hi I tested P2.5(128x64) RGB Panel with stm32F103RCT6 72Mhz and blackpill stm32F411CE 100Mhz

stm32F411CE with 1 panel(128x64) or 2 panels (128x128) without Noise and Flickering , Correct Colors , every test results OK.

stm32F103RC with 1 panel(128x64) without Noise and Flickering, Correct Colors , every test results OK.

stm32F103RC with 2 panels (128x128) without Noise and Correct Colors. But, have Flicker problem.

Is it possible to solve the flickering problem when using 2 panels?

board707 commented 4 months ago

Hi Which exactly stm32F103RC ? How much kilobytes of RAM it has?

digi55 commented 4 months ago

STM32F103RCT6 48Kb Ram , 256Kb Flash , 72Mhz

board707 commented 4 months ago

Please insert your code for STM32F103RCT6 with a two panels

digi55 commented 4 months ago

/*-------------------------------------------------------------------------------------- Demo for RGB panels

DMD_STM32a example code for STM32

Draw bitmap example. ------------------------------------------------------------------------------------- */

include "DMD_RGB.h"

include "bitmaps.h"

//Number of panels in x and y axis

define DISPLAYS_ACROSS 1

define DISPLAYS_DOWN 2

// Enable of output buffering // if true, changes only outputs to matrix after // swapBuffers(true) command // If dual buffer not enabled, all output draw at matrix directly // and swapBuffers(true) command do nothing

define ENABLE_DUAL_BUFFER false

// ==== DMD_RGB pins ==== // mux pins - A, B, C... all mux pins must be selected from same port!

define DMD_PIN_A PB6

define DMD_PIN_B PB5

define DMD_PIN_C PB4

define DMD_PIN_D PB3

define DMD_PIN_E PB8

// uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E }; uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };

// pin OE must be one of PB0 PB1 PA6 PA7

define DMD_PIN_nOE PB0

define DMD_PIN_SCLK PB7

// Pins for R0, G0, B0, R1, G1, B1 channels and for clock. // By default the library uses RGB color order. // If you need to change this - reorder the R0, G0, B0, R1, G1, B1 pins. // All this pins also must be selected from same port! uint8_t custom_rgbpins[] = {PA6, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

// Fire up the DMD object as dmd<MATRIX_TYPE, COLOR_DEPTH> // We use 64x32 matrix with 16 scans and 4bit color: DMD_RGB <RGB128x64plainS32,COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);

define BRIGHTNESS_DEFAULT 100 // (brightness 0-255, recomended 30-100)

// bitmap images to show const uint16_t bitmaps[] = {pict1, pict2, pict3, pict4, pict5}; uint8_t ptr = 0; /-------------------------------------------------------------------------------------- setup Called by the Arduino architecture before the main loop begins --------------------------------------------------------------------------------------*/

void setup(void){ enableDebugPorts();
dmd.init(); }

/-------------------------------------------------------------------------------------- loop Arduino architecture main loop --------------------------------------------------------------------------------------/

void loop(void) { if (ptr == (sizeof(bitmaps)/ sizeof(bitmaps[0]))) ptr =0;

// initial brightness uint8_t b=BRIGHTNESS_DEFAULT;
dmd.setBrightness(b);

// draw image starting from 0,0, width 64 height 32 // dmd.drawRGBBitmap(dmd.width() - 80, 0, bitmaps[ptr], 80, 80); dmd.drawRGBBitmap(dmd.width() - 128, 0, bitmaps[ptr], 128, 128);

// show the image during 15sec delay(3000);

/ // fading to dark while (b) { dmd.setBrightness(b); delay(100); b--; } /

// blank screen 2sec dmd.clearScreen(true); delay(200);

// increment image pointer ptr++; }

board707 commented 4 months ago

Sorry for the delay in testing. Unfortunately, I don't have such processors for real tests. After looking at the code, I didn't find any problems.

digi55 commented 4 months ago

Hi, I also don't think there is any problem with the code anyway.
Because there is no problem with the 100Mhz STM32F411CE. (1 panel P2.5 128x64 or 2panel 128x128)

When only 1 panel is used, also there is no problem with the 72Mhz stm32F103RC. But, When I using 2 panels, image flickering occurs. I think 72Mhz is not enough to scan 2 panels.

I wanted to ask, Do you have any advice to fixed this flickering problem when using 2 panels? (128x128)

board707 commented 4 months ago

I think 72Mhz is not enough to scan 2 panels.

Unfortunately, "the frequency is not enough" - helps nothing in that case. There may be problems in the code - for example, the update is too frequent for such a large amount of data. The fact is that I designed the library for the F103C series, which simply do not have enough memory to work with such panels. Therefore, the code for STM32F1 has never been tested on such big screens. Unfortunately, for now I can’t figure out how to solve the problem without real tests on the F103R-series controller, that I don't have.

digi55 commented 4 months ago

I understand, Thank you so much for your helps.

board707 commented 4 months ago

Hi I ordered a board with an F103RE controller from Ali, delivery in a month. I'll try to figure out the problems. I'll let you know when I have the results.

digi55 commented 4 months ago

Thank you so much !

board707 commented 3 months ago

Hi @digi55 I tested the board with F103RE controller, set the screen of 128x128 pixels. I observed some image jitter, especially on long lines of diodes. I think this is what you observed and described as a flickering. The most likely cause of artefacts is the low frame rate that F103 mcu can provide. On the F411 board, the FPS on such a screen will be approximately 80, while on the F103 it will be only 40-50. Update 40 times per second is most likely gives the jitter that the eye notices in the picture on the matrix. I'll try to increase the output speed a little and report the result. But it is unlikely that the speed can be increased significantly.

digi55 commented 3 months ago

Hi @board707 Yes, this is exactly the problem I'm talking about. With the 128x128 P2.5 panel, there is a slight flicker because the refresh rate in F103 is not enough. Thank you very much for your interest. I hope this little acceleration will be enough. I'm looking forward to the result.

board707 commented 3 months ago

Hi @digi55 Unfortunately, I did not find a way to increase the speed of the STM32F1 controllers in my library. As I remember, you use STM32F1, not F4, because F4 does not have EEPROM. It might be easier to run EEPROM on F4 than to speed up F1 :)

By the way. I don’t remember, I already asked you, where are you from?

digi55 commented 3 months ago

Hi @board707 yes, I am using stm32F103RCT6. Everything is ok with stm32F411CE, only problem is does not have EEPROM support. I think, I don't have another choice. I need to use 32F411 and an external EEPROM. I am from Istanbul / Turkey

board707 commented 3 months ago

I need to use 32F411 and an external EEPROM.

I'll see if we can use EEPROM emulation on the F411 in the same way as it was done on the F103, but I'm not sure I have enough knowledge for that. Perhaps using an external EEPROM will be the simplest solution.

By the way - I remember you asked about panels with DP3364 and SM16380 drivers. Do you still have these panels at your disposal? Perhaps I will be able to add them to the library, could I will ask you to run some tests on these panels?

digi55 commented 3 months ago

Hi @board707 While looking for compatible 128x64 P2.5 panels for our library, I purchased several different samples. I returned some of the ones that were not compatible. I'm not sure which ones there are right now. I have to check. Of course, I would be happy to help you.

digi55 commented 2 months ago

Hi again @board707 I decided to use STM32F411RE (64 pin) and 24c16 eeprom to use on P2.5 (128x64) panel But, there is only STM32F411CEU (48 pin) among the arduino board options. I want to use STM32F411RE (64 Pin). Do you have any advice on how I can do this?

board707 commented 2 months ago

I want to use STM32F411RE (64 Pin). Do you have any advice on how I can do this?

The core for F411 already in the Clark STM32 package. To work with another version of the F411 chip you have to add a new board variant to the STM32F4/variants folder with full description of the pins, interfaces, memory etc

digi55 commented 2 months ago

I just added the missing pins, in variants/blackpill_f411.h I hope it works. Because everything looks the same, except the number of pins.

digi55 commented 1 month ago

Hi, @board707 Unfortunately, the pin additions I made did not work.

And I do not know exactly what to do. Can you help me with adding the STM32F411RET6 (64 Pin) processor?

board707 commented 1 month ago

As far as I know, the 411RE and CE differ only in the number of pins. This means that your controller should work with the library if you compile the code for the blackpil 411CE board (and of course, you should only use the pins that the CE has). First, try to permorm such a test - if it passes, then we can start adding pins. If the library does not work, then the problem is somewhere else.

digi55 commented 1 month ago

When I upload code by selecting CE, some pins work. For example, when I connect an LED, I can turn it on and off. But when I connect it to the P4 panel, I cannot get an image. Because the signal is very weak on some pins.

board707 commented 1 month ago

Because the signal is very weak on some pins.

Do you mean the pins, that exist only on RE chip? You should use only ones, that exits both on CE and RE. These pins should works.

digi55 commented 1 month ago

The pins I used for the P4 panel are available on both. I am using the pins you gave in the sample file.

board707 commented 1 month ago

The situation is not clear for me, sorry. It's hard to solve such issues remotely. I don't have a proper controller to test.

Remind me, what's the reason for your choice of this particular controller? Why can't you use a standard 411CE blackpill?

digi55 commented 1 month ago

Because, I need a 64 pin processor. I designed a motherboard with STM32F411RE processor. The motherborad is ready now. But the problem is that this processor option is not available in Arduino. I want to use P4 and P2.5 panels with this motherboard.

board707 commented 1 month ago

I apologize for what is written below, maybe I understand something incorrectly. However, in my opinion, if you use the same pins on the 411RE as on the CE, the library should work on the RE and CE the same way. If it does not work for you, then this may indicate an error in the design of the board. Or maybe the difference between the controllers is greater than we thought. In any case, until you able to run the library on the RE chip with the same settings. as the CE - adding support for additional pins does not make sense.

By the way, on what the clock frequency do you run the 411RE on your PCB?

digi55 commented 1 month ago

I am using a 25Mhz crystal like on the blackpill. Now I will test all the pins one by one and try to find out which ones have problem.

board707 commented 1 month ago

I am using a 25Mhz crystal like on the blackpill.

Do you also use a clock multiplication like on the blackpill? What is the resulting core frequency? The library is written considering 100 MHz core clock.

digi55 commented 1 month ago

yes, I am using 100 Mhz

digi55 commented 1 month ago

Hi again, I found the source of the problem. A simple soldering error on pcb. Now everything works, except the PD2 pin. P4 and P2.5 RGB Panels are also fine. I haven't been able to activate the I2C2 port yet. This is necessary for the EEPROM. Thank you very much for your help and support.

digi55 commented 1 month ago

all other pins are OK PD2 pin is not working, do you have any advice?

board707 commented 1 month ago

PD2 pin is not working, do you have any advice?

Is there such a pin on the blackpill 411? Below is a list of all blackpill pins defined in the STM32 Arduino package:

enum {
PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12,PA13,PA14,PA15,
PB0,PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8,PB9,PB10,PB12=(PB10+2),PB13,PB14,PB15,
PC13=(32+13),PC14,PC15,
BOARD_NR_GPIO_PINS
};

I don't see a PD2 here - so it is a quite expecting that the pin doesn't work.

digi55 commented 1 month ago

enum { PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12,PA13,PA14,PA15, PB0,PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8,PB9,PB10,PB12=(PB10+2),PB13,PB14,PB15, PC0,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC12,PC13,PC14,PC15, PD2,PH0,PH1, BOARD_NR_GPIO_PINS };

in this way, I added all the pins needed for 64 pin (STM32F411RE). All of them working. Only PD2 does not work. I don't get any errors during compilation. But, it not working. I don't know why

board707 commented 1 month ago

Firstly, I think you added the pins not quite correctly, probably it should be edited this way:

enum {
PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12,PA13,PA14,PA15,
PB0,PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8,PB9,PB10,PB12=(PB10+2),PB13,PB14,PB15,
PC0,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC12,PC13,PC14,PC15,
PD2=(48+2),
PH0 = (64 +0) ,PH1,
BOARD_NR_GPIO_PINS
};

In addition, it is not enough to just edit the list. You need to add to the other code work with pins on the PD and PH ports, which are not in the standard blackpill

digi55 commented 1 month ago

Thank you very much @board707 , PD2 pin finally worked.

I couldn't find an explanation anywhere on how to activate I2C2 (PB10, PB3).

digi55 commented 1 month ago

include

TwoWire Wire2 (2, I2C_FAST_MODE); // I2C2 ( scl=PB10, sda=PB3)

define Wire Wire2

include

AT24C02 EEPROM(AT24C_ADDRESS_0);

uint8_t BRIGHTNESS_adres = 20; uint8_t BRIGHTNESS = 0;

void setup() { Wire.begin(); delay(30); BRIGHTNESS = EEPROM.read(BRIGHTNESS_adres);

}

void loop() {

}

digi55 commented 1 month ago

With this code, stm32F103RC and 24c02 eeprom work without any problems.

But it freezes with stm32F411. When I check with an oscilloscope, there is no signal on the relevant pins.

I'm sorry, I know I'm asking you too many questions, but I don't have much experience with the stm32 family. Do you have any advice on this?

board707 commented 1 month ago

Please attach the file at24c02.h, I would run some tests

digi55 commented 1 month ago

https://github.com/stefangs/arduino-library-at24cxxx

board707 commented 1 month ago

Thank you.

digi55 commented 1 month ago

Thank you too

board707 commented 1 month ago

Hi Sorry for delay with answer. When you added the pins, did you edit the existing variants/blackpill_f411.h file in place or did you create a new variant for your mcu? in any case, please show the resulting file

digi55 commented 1 month ago

/**

/**

ifndef _BOARD_BLACKPILL_F411H

define _BOARD_BLACKPILL_F411H

//#define Port2Pin(port, bit) ((port-'A')*16+bit)

define CLOCK_SPEED_MHZ 96

define BOARD_LED_PIN PC13

define BOARD_USB_DM_PIN PA11

define BOARD_USB_DP_PIN PA12

define BOARD_NR_USARTS 3

define BOARD_USART1_TX_PIN PA9

define BOARD_USART1_RX_PIN PA10

define BOARD_USART2_TX_PIN PA2

define BOARD_USART2_RX_PIN PA3

//#define BOARD_USART6_TX_PIN PA11 // USB_DM //#define BOARD_USART6_RX_PIN PA12 // USB_DP

define BOARD_NR_I2C 1

define BOARD_I2C1_SCL_PIN PB6

define BOARD_I2C1_SDA_PIN PB7

define BOARD_I2C1A_SCL_PIN PB10

define BOARD_I2C1A_SDA_PIN PB3

define BOARD_NR_SPI 3

define BOARD_SPI1_NSS_PIN PA4

define BOARD_SPI1_SCK_PIN PA5

define BOARD_SPI1_MISO_PIN PA6

define BOARD_SPI1_MOSI_PIN PA7

define BOARD_SPI2_NSS_PIN PB12

define BOARD_SPI2_SCK_PIN PB13

define BOARD_SPI2_MISO_PIN PB14

define BOARD_SPI2_MOSI_PIN PB15

define BOARD_SPI3_NSS_PIN PA15

define BOARD_SPI3_SCK_PIN PB3

define BOARD_SPI3_MISO_PIN PB4

define BOARD_SPI3_MOSI_PIN PB5

//#define BOARD_NR_GPIO_PINS 42

define BOARD_NR_PWM_PINS 22

define BOARD_NR_ADC_PINS 16

define BOARD_NR_USED_PINS 52 // ala42 not set yet

define BOARD_JTMS_SWDIO_PIN PA13

define BOARD_JTCK_SWCLK_PIN PA14

enum { PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12,PA13,PA14,PA15, PB0,PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8,PB9,PB10,PB12=(PB10+2),PB13,PB14,PB15, PC0,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC12,PC13=(32+13),PC14,PC15, PD2=(48+2), PH0=(64+0),PH1, BOARD_NR_GPIO_PINS };

endif

digi55 commented 1 month ago

Hi, @board707 I edited the existing variants/blackpill_f411.h file.

board707 commented 1 month ago

Pay attention to these lines in your file:

#define BOARD_NR_I2C 1
#define BOARD_I2C1_SCL_PIN PB6
#define BOARD_I2C1_SDA_PIN PB7
#define BOARD_I2C1A_SCL_PIN PB10
#define BOARD_I2C1A_SDA_PIN PB3

The first line is indicated that the controller has only one I2C interface. Additionally, the last two lines defines a I2C1A interface, which is incorrect.

To use a two interfaces, try changing this piece like this:

#define BOARD_NR_I2C 2
#define BOARD_I2C1_SCL_PIN PB6
#define BOARD_I2C1_SDA_PIN PB7
#define BOARD_I2C2_SCL_PIN      PB10
#define BOARD_I2C2_SDA_PIN      PB3

and test it again.

digi55 commented 1 month ago

I made the necessary correction and

When I checked with an oscilloscope, There is still no signal on the SCL2 (PB10) pin. I can finally see a signal on the SDA2 (PB3) pin.

board707 commented 1 month ago

So it means that second I2C not worked again?

Ok, I'll try to think of something else :)

digi55 commented 1 month ago

Unfortunately, I2C2 still didn't work.

But after this fix, I can now see a signal from PB3. I still don't understand why there is no signal from PB10 ((

board707 commented 1 month ago

Did you pullup SCL and SDA to 3.3v ?