Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about the Configuration Register #2

Open
monkey029 opened this issue Feb 6, 2024 · 10 comments
Open

about the Configuration Register #2

monkey029 opened this issue Feb 6, 2024 · 10 comments

Comments

@monkey029
Copy link

hi

do you know how to write or read the Configuration Register of ICND2153?

Thanks!

@CamelCaseName
Copy link
Owner

hi,

i tried around with them but only before getting it to work anyways, so i didnt persue it any more.

you can find a register listing for a very very similar chip in the linked datasheets in the readme here,

as well in this discussion on hzellers rpi rgb matrix.

maybe this year, as part of the merging of hub75nano and hub75enano i'll work on those type of panels some more.

wish you the best in getting it to work

@joancarlesvila
Copy link

hi,
here an example of how i write icnd2153 registers,
previous to write any register, preactive command must be send,

in this example I write reg1 and reg 2
in reg1 you can configure the led board scan ( i have 64x64 S16 led board)
in reg 2 you can config the luminosity (gain) parameter for led board

I hope this helps.

#define PREACTIVATE_COMMAND_CLK 14
#define REG1_WRITE_CLK 4
#define REG2_WRITE_CLK 6

in main()
{
icnd2153_ControlCommand(PREACTIVATE_COMMAND_CLK );
icnd2153_WriteConfigReg(DRIVERS, 0x0F78,REG1_WRITE_CLK ); // Write config register 1 (4 latches)
icnd2153_ControlCommand(PREACTIVATE_COMMAND_CLK );
icnd2153_WriteConfigReg(DRIVERS, 0xFFFF,REG2_WRITE_CLK ); // Write config register 2 (6 latches)
}
void icnd2153_ControlCommand( uint8_t NumberOfClocks )
{
HIGH_LAT // latch ON
while(NumberOfClocks--)
{
HIGH_CLK;
CLEAR_CLK;
}
CLEAR_LAT; // latch OFF
}
void icnd2153_WriteConfigReg( uint8_t NXips, uint16_t DatCfg, uint8_t NumberOfClocks )
{
icnd2153_SendDataToAllDrivers(DatCfg, NXips, NumberOfClocks);
}
void icnd2153_SendDataToAllDrivers(uint16_t Data, uint16_t driversNum, uint8_t latches)
{
while (driversNum)
{
icnd2153_SendData(Data, driversNum == 1 ? latches : 0);
driversNum--;
}
}
void icnd2153_SendData(uint16_t DatCfg, uint8_t latches)
{
uint8_t bit = 0;
uint16_t mask = 0x8000;

while (mask)
{
	CLEAR_CLK;
	if (bit == (16 - latches))
		HIGH_LAT;

	if(DatCfg & mask)
			GPIOA->ODR = 0x3f;
		else
			GPIOA->ODR = 0x00;
	HIGH_CLK;
	mask >>= 1;
	bit++;
}
CLEAR_CLK;
CLEAR_LAT;

}

@CamelCaseName
Copy link
Owner

that's awesome, iirc I once had very same code in this library but before I got the row addressing to work so I removed it haha.

definitely worth checking out and I thank you very much

@joancarlesvila
Copy link

nice to help you.

i work with one led board and work perfect, but when chaining two led boards the image gets unstable,
do you know if the icnd2153 has timmings requirements ?

@monkey029
Copy link
Author

monkey029 commented Feb 19, 2024

hi,

I have tried to write reg1 with 4 latches to set the numbers of scan lines, and it works.
when I send the gsdata = 0x0001, and set scan lines with 16 or 32, the OUT channels can change like the following pictures .
微信图片_20240219165750
微信图片_20240219165653

but when I try to set the low-grayscale and color cast compensation in reg3 and reg4, the OUT channels have no change, and I found that when the reg4-bit6 was set to 0, the OUT channels didn't work like the gsdata that I have send.

have you tried configuring the other registers or read the registers?

please excuse my poor English,Thanks!

@joancarlesvila
Copy link

hi @monkey029 .
at this moment, i have only programmed the scan lines at register 1 ,
and Current gain parameter at register 2 to change the luminosity.

I haven't programmed the other registers because i don't understand what they do.

@joancarlesvila
Copy link

hi @monkey029
I have seen in you pictures, that you doesn't move the GCLK signal to load serial data info for pixels,
i load the info in other way and i can only work with ONE led board.

please could you share your the code with me.
thank-you

@monkey029
Copy link
Author

monkey029 commented Feb 20, 2024

hi @monkey029 I have seen in you pictures, that you doesn't move the GCLK signal to load serial data info for pixels, i load the info in other way and i can only work with ONE led board.

please could you share your the code with me. thank-you

i think the DCLK is for serial data input, so i run DCLK when write the data for reg configuration or pixels, and run GCLK when display the gray scale.
i just control ONE ic without led board, and i use stm32 to generate the singals, here are part of the code.

int main() {
	unsigned short gs_data = 0x0001;
	Run_DCLK(30080);
	while(1)
	{
        	ICND2153_Vsync();
        	Write_ICND_Reg('A', ICND_REG0, 0x1F30);
        	Write_ICND_Reg('A', ICND_REG1, 0xFF99);
        	Write_ICND_Reg('A', ICND_REG2, 0x4007);
        	Write_ICND_Reg('A', ICND_REG3, 0x4040);
        	Write_ICND_Reg('A', ICND_REG4, 0x0008);

        	Wirte_GSData_For_ICND2153(gs_data);
	}
}

void ICND2153_Vsync(){
    unsigned char dly;
    /* open the output channels */
    LE_Hight_In_DCLK(14);
    for (dly = 0; dly < 20; dly++) {__NOP();}
    LE_Hight_In_DCLK(12);   
    for (dly = 0; dly < 20; dly++) {__NOP();}
    
    /* vsync singal */
    LE_Hight_In_DCLK(3);
    for (dly = 0; dly < 20; dly++) {__NOP();}
}

/* send the pre_singal */
void Pre_Signal() {
    unsigned char dly;
    for (dly = 0; dly < 20; dly++) {__NOP();}
    LE_Hight_In_DCLK(14);
    for (dly = 0; dly < 20; dly++) {__NOP();}
}

/* config reg */
void Write_ICND_Reg(unsigned char color, unsigned char reg, unsigned short data) {
    unsigned char i, j, m, n;
    unsigned char cnt = 0;
    n = 16 - reg;

    unsigned short temp_data = data;
  
    Pre_Signal();
    Reset(GCLK|DCLK|LE);
    
    /* write serial data */
    for(i = 0; i < 16; i++) {
        if (temp_data & 0x8000) {
            if (color == 'R') Set(SDI_R);
            else if (color == 'G') Set(SDI_G);
            else if (color == 'B') Set(SDI_B);
            else Set(SDI_R|SDI_G|SDI_B);
        }
        else Reset(SDI_R|SDI_G|SDI_B);
        temp_data <<= 1;
        
        if (i == n) Set(LE);

        Set(DCLK);
        for (m = 0; m < 1; m++) {__NOP();}
        Reset(DCLK);
    }
    
    Reset(SDI_R|SDI_G|SDI_B|LE);
}

void Wirte_GSData_For_ICND2153(unsigned short gs_data) {
    unsigned char i,m,j,t;
    Reset(LE);
    
    // 32 lines
    for (t = 0; t < LINE_NUMS; t++) {
    // 16 channels
        for (i = 0; i < CHANNEL_NUMS; i++) {
            unsigned short temp_data = gs_data;
            // 16bit for each channels
            for (j = 0; j < REG_BIT_NUMS; j++) {
                if (temp_data & 0x8000) Set(SDI_R);
                else Reset(SDI_R);
                if (temp_data & 0x8000) Set(SDI_G);
                else Reset(SDI_G);
                if (temp_data & 0x8000) Set(SDI_B);
                else Reset(SDI_B);
                
                temp_data <<= 1;
                
                // last bit, latch the data
                if (j == REG_BIT_NUMS - 1) Set(LE);
                else Reset(LE);

                Set(DCLK);
                for(m = 0; m < 1; m++){__NOP();}
                Reset(DCLK);
        }
        Reset(LE);
        Reset(SDI_R|SDI_G|SDI_B);
      }
    }

    // run gclk for display
    Run_GCLK(2260992);
}

@monkey029
Copy link
Author

hi @monkey029 . at this moment, i have only programmed the scan lines at register 1 , and Current gain parameter at register 2 to change the luminosity.

I haven't programmed the other registers because i don't understand what they do.

i found a reg map in this link that provided by CamelCaseName(and thanks for the author of this picture, wata-net), but i am not sure whether it is correct, i have tried to read the reg but no output from the SDO. and as i have saied before, the low-grayscale and color cast compensation configuration didnt work.
211237326-9d372f42-654c-4259-bc3e-e670c315e6e0

@CamelCaseName
Copy link
Owner

i updated the original hub75nano library with this code here for simple 1 bit output, you can try if you want. i broke my panel a while back (10V at the power connector oops), replaced a chip(input buffer for clk and oe) but still some things don't work. (green in upper half and the first 32 leds are all output disabled, think i broke one pin of the buffer chip when changing it)

IMG20240227175419

i have some more panels and an huidu hd-d16 controller in the mail, will also capture the controller and upload the data here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants