Monday, April 08, 2013
Guzunty Pi LED driver core troubleshooting notes
Now I am looking more closely the 4 digit LED driving signals. When I first read the following statement in the demo program. I thought the master clock is 5MHz. Actually I think it is 5MHz counted down many times to 1.17KHz x 4 = 4.68KHz. The further counted down 1.17 KHz is then used to multiplex the 4 LED digits, I think.
gz_clock_ena(GZ_CLK_5MHz, 0xfff); // Turn on the slowest clock we can
Now I am thinking of using HC04 quad open collector NAND gates to level shift the 3V3 signals to 5V0.
I will also use ULN2803 to shift the segment signals from 3V3 to 5V0.
I am thinking of using HC573 to buffer the ULN2803 outputs to drive the LEDs.
One more thing I am not sure is that it appears that the LED driver core needs to power reset often, or for the first time after power reset, otherwise it will not start. I need to verify this later.
***
* gz_led_demo.c - guzunty
...
gz_clock_ena(GZ_CLK_5MHz, 0xfff); // Turn on the slowest clock we can
...
unsigned char payload[4];
...
gz_spi_set_width(4); // Pass blocks of 4 bytes on SPI
while (1)
{
int i = 0;
{
time_t t;
time(&t);
char time_buf[4];
char time_str[25];
sprintf(time_str, "%s",ctime(&t));
time_buf[0] = time_str[11];
time_buf[1] = time_str[12];
time_buf[2] = time_str[14];
time_buf[3] = time_str[15];
for (; i < 4; i++)
{
payload[i] = ~font[(unsigned char)time_buf[i]];
}
if (colon != 0)
{
payload[1] &= ~0x80;
colon = 0;
}
else
{
colon = 1;
}
}
...
gz_spi_write(payload); // pass display bytes to SPI
sleep(1);
}
}
...
gz_spi_close(); // close SPI channel
...
gz_clock_dis(); // turn off GPIO clock
digit_enas<0>
digit_enas<1>
digit_enas<2>
digit_enas<3>
.END
No comments:
Post a Comment