This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GPIO Pin read speed using mmap

Hi everyone,

I am testing the DM6446 and would like to read digital data from an A/D converter using GPIO pins. The data rate varies from 300kbps to 5Mbps. To read GPIO, I am reading /dev/mem using mmap command like so:

mem_fd = open("/dev/mem",O_RDWR);

map_base = mmap(NULL, MAP_SIZE, PROT_READ, MAP_SHARED, mem_fd, mem_location & MAP_MASK);

virt_addr = map_base + (mem_location & MAP_MASK);

read_GPIO =  *((unsigned long *) virt_addr);

 

I can read the GPIO pins fine, but not fast enough for my purposes. I can barely clock data in at 100kbps. Is there another way of doing this? I can toggle GPIO out with a frequency of 25Mhz, but reading GPIO is slow...any suggestion? Thanks.