TOP
SSV Software Systems Register  Register
Log in to check your private messages  Log in to check your private messages
Startseite FAQ Search Mitglieder Profile  Log in 
SSV Support-Forum
I2C nutzen ...

 
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/9265
<<< Previous topic - Next topic >>>  
Display posts from previous:   
Author Message
kdw



Joined: 05 May 2006
Posts: 1460

PostPosted: 02.09.2011, 13:58    Post subject: I2C nutzen ... Reply with quote

Hallo Forum.

Zunächst einmal müssen die erforderlichen Module im Dateisystem des DNP/9265 abgelegt und geladen werden:

Code:
root@emblinux:~$ insmod <path_to_module>/i2c-core.ko
root@emblinux:~$ insmod <path_to_module>/i2c-dev.ko
root@emblinux:~$ insmod <path_to_module>/i2c-algo-bit.ko
root@emblinux:~$ insmod <path_to_module>/i2c-gpio.ko


Dann kann man I2C nutzen. Der folgenden Code zeigt, wie man abfragen kann, ob die Treiber geladen wurden:

Code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/i2c-dev.h>

int main(void) {
    int fd;
    //open device
    if ((fd = open("/dev/i2c0",O_RDWR)) < 0) {
        printf( "Fehler I2C open errno:%d %s",
                 errno, strerror(errno));
        return 1;
    }
    //do somethings

    //close device
    close(fd);
    return 0;
}

Gruß

KDW
Back to top
View user's profile Send private message
hne



Joined: 11 Jul 2008
Posts: 210
Location: Hannover

PostPosted: 23.10.2012, 17:54    Post subject: Reply with quote

Der I2C-Bus muss in der SSV-Hardware-Config aktiviert werden, d.h. über den uBoot geändert werden.

Dazu die ist die Datei /Linux/product_recovery/buildup-3791/linux/kernel/ssvhwcnf-dnp9265.bin von der CDROM entsprechend von "i2c=0" auf "i2c=1" zu ändern.

Achtung!
Die Zeile endet mit einem 00h! Bitte einen Linux-Editor nehmen, der die 00h am Ende nicht entfernt, z.B. "mcedit".

Wie diese Datei eingespielt wird, steht in der Datei /Linux/product_recovery/buildup-3791/HOWTO-install, ebenfalls auf der CDROM.
_________________
Henry Nestler
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/9265 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

SSV Software Systems GmbH

Dünenweg 5
30419 Hannover

Fon: +49(0)511  ·  40 000-0
Fax: +49(0)511  ·  40 000-40

sales@ssv-embedded.de


Impressum    ·    Datenschutz    ·    AGB

© 2023 SSV SOFTWARE SYSTEMS GmbH. Alle Rechte vorbehalten.

ISO 9001:2015