Hallo,
ich hab nun die erste Platine mit einem TLC5940, nur leider will das
ganze noch nicht so ganz funktionieren...
Hier mal ein kurzer Schaltplan:
TLC5940 - Potential
VPRG - GND
XLAT - VCC
BLANK - VCC (über 10kΩ und an PB2)
DCPRG - GND
SIN - MOSI (SPI)
SCLK - SCK (SPI)
GSLCK - 204,8 kHz Rechteck-Signal
Verbindungen habe ich schon alle überprüft. Mit einem DSO sind alle
Signal-Pegel auch sauber. Nur leider tut sich nichts an den Ausgängen
des TLC5940.
Hier mal mein "Code-Schnipsel":
1 | #include <avr/io.h>
|
2 | #include <avr/interrupt.h>
|
3 |
|
4 | #define sleep() asm volatile ("nop")
|
5 |
|
6 | // TLC5940_BLANK PB2
|
7 |
|
8 | volatile uint8_t data[10];
|
9 |
|
10 | int main(void)
|
11 | {
|
12 | // 204,8 kHz initalisieren
|
13 | TCCR1A = (1<<COM1A1) | (1<<WGM11);
|
14 | TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS10);
|
15 | ICR1 = 77;
|
16 | OCR1A = 38;
|
17 |
|
18 | // SPI initalisieren
|
19 | DDRB = (1<<PB3)|(1<<PB5)|(1<<PB1)|(1<<PB2);
|
20 | SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0);
|
21 |
|
22 | sei();
|
23 |
|
24 | PORTB |= (1<<PB2); // HIGH
|
25 |
|
26 | SPDR = 96;
|
27 | while (!(SPSR & (1<<SPIF)));
|
28 | SPDR = 96;
|
29 | while (!(SPSR & (1<<SPIF)));
|
30 | SPDR = 96;
|
31 | while (!(SPSR & (1<<SPIF)));
|
32 | SPDR = 96;
|
33 | while (!(SPSR & (1<<SPIF)));
|
34 | SPDR = 96;
|
35 | while (!(SPSR & (1<<SPIF)));
|
36 | SPDR = 96;
|
37 | while (!(SPSR & (1<<SPIF)));
|
38 | SPDR = 96;
|
39 | while (!(SPSR & (1<<SPIF)));
|
40 | SPDR = 96;
|
41 | while (!(SPSR & (1<<SPIF)));
|
42 | SPDR = 96;
|
43 | while (!(SPSR & (1<<SPIF)));
|
44 | SPDR = 96;
|
45 | while (!(SPSR & (1<<SPIF)));
|
46 | SPDR = 96;
|
47 | while (!(SPSR & (1<<SPIF)));
|
48 | SPDR = 96;
|
49 | while (!(SPSR & (1<<SPIF)));
|
50 | SPDR = 96;
|
51 | while (!(SPSR & (1<<SPIF)));
|
52 | SPDR = 96;
|
53 | while (!(SPSR & (1<<SPIF)));
|
54 | SPDR = 96;
|
55 | while (!(SPSR & (1<<SPIF)));
|
56 | SPDR = 96;
|
57 | while (!(SPSR & (1<<SPIF)));
|
58 | SPDR = 96;
|
59 | while (!(SPSR & (1<<SPIF)));
|
60 | SPDR = 96;
|
61 | while (!(SPSR & (1<<SPIF)));
|
62 | SPDR = 96;
|
63 | while (!(SPSR & (1<<SPIF)));
|
64 | SPDR = 96;
|
65 | while (!(SPSR & (1<<SPIF)));
|
66 | SPDR = 96;
|
67 | while (!(SPSR & (1<<SPIF)));
|
68 | SPDR = 96;
|
69 | while (!(SPSR & (1<<SPIF)));
|
70 | SPDR = 96;
|
71 | while (!(SPSR & (1<<SPIF)));
|
72 | SPDR = 96;
|
73 | while (!(SPSR & (1<<SPIF)));
|
74 |
|
75 | PORTB &= ~(1<<PB2); // LOW
|
76 |
|
77 | while(1){};
|
78 | return 0;
|
79 | }
|
Kann leider keinen Fehler finden. Eigentlich müsste man doch zumindest
was an den Ausgängen des TLC "zappeln" sehen, nur dummerweise zeigt das
Oszi konstant 0V an :/
PWM-Takt ist vorhanden, 24 Bytes werden mittels SPI übetragen und Blank
wird nach dem senden auf GND gezogen (nachgemessen). Weiß leider
momentan nicht weiter.
Hoffe, ihr könnt mir etwas helfen :)
Viele Grüße
Julian