[SOM APF8 - iMX28] file system gpio event crach board

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

[SOM APF8 - iMX28] file system gpio event crach board

866 次查看
loicr
Contributor I

Hi,

When I configure sysfs gpio, for example :

cd /sys/class/gpio/

echo 45 > export

echo rising > edge // or falling or both

and use program after, my board crash.

When I configure the edge at "none", the poll is not blocking

Can you help me please?

Best Regards

Loïc

-----------------------------------------------------------------------------

#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char * argv[])
{
    int fd;
    struct pollfd  fds;
    char buffer[2];

    if (argc != 2) {
        fprintf(stderr, "usage: %s \n", argv[0]);
        exit(EXIT_FAILURE);
    }
    if ((fd = open(argv[1], O_RDONLY)) < 0) {
        perror(argv[1]);
        exit(EXIT_FAILURE);
    }
    while (1) {
        fds.fd = fd;
        fds.events = POLLPRI; // or POLLIN
        if (poll(& fds, 1, -1) < 0) {
            perror("poll");
            break;
        }
    printf("event\n");
        lseek(fd, 0, SEEK_SET);
        if (read(fd, & buffer, 2) != 2) {
            perror("read");
            break;
        }
        buffer[1] = '\0';
    }
    close(fd);
    return EXIT_SUCCESS;
}

标记 (3)
0 项奖励
回复
1 回复

808 次查看
fabio_estevam
NXP Employee
NXP Employee

Which kernel version do you use? Can you try with a recent kernel, such as 4.14.13?

Regards,

Fabio Estevam

0 项奖励
回复