Hallo Liste, ich bin gerade dabei eine C Bibliothek für das fnordlicht-Protokoll [1] zu schreiben. Diese soll "fnlib" heißen. Ziel ist es ein einfaches Interface zu bieten, dass jeder in seine eigenen Programme integrieren kann. Ich möchte soweit möglich den bestehenden Sourcecode [2] verwenden, sodass wir die Bibliothek in Kombination mit einem Demoprogramm im git-Repo veröffentlichen können.
Erstmal aber eine Frage:
Gemäß der Dokumentation des PULL_INT Befehls:
"Instruct the adressed device to immediately pull down the INT line (connected to all devices in parallel) for a given amount of time. This can be efficiently used to determine the number of devices listening to the bus (eg. by binary search)."
Soll es mit diesem möglich sein die Anzahl der fnordlichter am Bus zu zählen. Soweit ich das verstanden hab soll hier einfach beginnend mit dem Busmaster die INT-Leitung auf Masse gezogen werden. Ist dieser verfügbar, wird INT auf GND gezogen. Forlaufend wird jetzt das Adressbyte inkrementiert bis irgendwann ein fnordlicht adressiert wird, das es eigentlich gar nicht gibt. Folglich wird auch die INT-Leitung nicht auf Masse gezogen. Nun leider habe ich gerade meine fnordlichter mit einem MAX232 und einem USB-Seriellwandler an meinem Rechner hängen. Habe also keinen Zugriff auf die INT-Leitung. Gibt es hier noch eine Alternative die Anzahl der Geräte auf dem Bus zu bestimmen? Oder soll ich eine der Leitungen des RS232 Ports, die eigentlich für den Hardware Handshake gedacht sind misbrauchen? Also RTS, CTS, DCD oder DTR?
gruß Steffen
[1] http://github.com/fd0/fnordlicht/raw/master/doc/PROTOCOL [2] http://github.com/fd0/fnordlicht/tree/master/common/
So ich bin es schon wieder. Das Zählen der fnordlichter am Bus funktioniert bereits. Ich musste meinen RS232 Pegelwandler für den CTS-Pin um einen weiteren Kanal ergänzen. Glücklicherweise hat der MX232 hier aber sogar jeweils zwei Kanäle.
Dann habe ich die Interuptleitung auf CTS gelegt und konnte mit meinem Programm gut den Status der INT-Leitung abfragen.
Leider habe ich ein Problem mit meinem Busmaster. Das erste fnordlicht (der Busmaster) initialisiert den Bus. Jedoch habe ich es noch nicht geschafft min diesem Busmaster den PULL_INT Befehl auszuführen.
Genau genommen bin ich mir über die Funktion dieser INT-Leitung noch nicht ganz im Klaren. Hat sie neben der Bootloader und dem Zählen der Busteilnehmer noch eine andere Funktion?
gruß Steffen
Am Samstag, den 21.08.2010, 15:49 +0200 schrieb Steffen Vogel:
Hallo Liste, ich bin gerade dabei eine C Bibliothek für das fnordlicht-Protokoll [1] zu schreiben. Diese soll "fnlib" heißen. Ziel ist es ein einfaches Interface zu bieten, dass jeder in seine eigenen Programme integrieren kann. Ich möchte soweit möglich den bestehenden Sourcecode [2] verwenden, sodass wir die Bibliothek in Kombination mit einem Demoprogramm im git-Repo veröffentlichen können.
Erstmal aber eine Frage:
Gemäß der Dokumentation des PULL_INT Befehls:
"Instruct the adressed device to immediately pull down the INT line (connected to all devices in parallel) for a given amount of time. This can be efficiently used to determine the number of devices listening to the bus (eg. by binary search)."
Soll es mit diesem möglich sein die Anzahl der fnordlichter am Bus zu zählen. Soweit ich das verstanden hab soll hier einfach beginnend mit dem Busmaster die INT-Leitung auf Masse gezogen werden. Ist dieser verfügbar, wird INT auf GND gezogen. Forlaufend wird jetzt das Adressbyte inkrementiert bis irgendwann ein fnordlicht adressiert wird, das es eigentlich gar nicht gibt. Folglich wird auch die INT-Leitung nicht auf Masse gezogen. Nun leider habe ich gerade meine fnordlichter mit einem MAX232 und einem USB-Seriellwandler an meinem Rechner hängen. Habe also keinen Zugriff auf die INT-Leitung. Gibt es hier noch eine Alternative die Anzahl der Geräte auf dem Bus zu bestimmen? Oder soll ich eine der Leitungen des RS232 Ports, die eigentlich für den Hardware Handshake gedacht sind misbrauchen? Also RTS, CTS, DCD oder DTR?
gruß Steffen
[1] http://github.com/fd0/fnordlicht/raw/master/doc/PROTOCOL [2] http://github.com/fd0/fnordlicht/tree/master/common/