Create a 32b parallel bus
Hello, I am working on the stm32mp157-dk1. I would like to create a 32bits parallel bus on cortex A7, at a frequency greater than 20Mhz but when I do a test on a pin I get a max frequency of 120khz, which is too low. I think this is the wrong program.
Can anyone help me
Here is my code
// SPDX-License-Identifier: GPL-2.0-only
/*
* gpio-hammer - example swiss army knife to shake GPIO lines on a system
*
* Copyright (C) 2016 Linus Walleij
*
* Usage:
* gpio-hammer -n <device-name> -o <offset1> -o <offset2>
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <poll.h>
#include <fcntl.h>
#include <getopt.h>
#include <sys/ioctl.h>
#include <linux/gpio.h>
#include "gpio-utils.h"
int hammer_device(const char *device_name, unsigned int *lines, int nlines, unsigned int loops)
{
struct gpiohandle_data data;
int fd;
int ret;
unsigned int iteration = 0;
memset(&data.values, 0, sizeof(data.values));
ret = gpiotools_request_linehandle(device_name, lines, nlines,
GPIOHANDLE_REQUEST_OUTPUT, &data,
"gpio-hammer");
fd = ret;
ret = gpiotools_get_values(fd, &data);
while(1)
{
data.values[0] = !data.values[0];
ret = gpiotools_set_values(fd, &data);
gpio_set_value(PIN90, 0);
for(short int h=0;h<1;h++);
}
ret = 0;
exit_close_error:
gpiotools_release_linehandle(fd);
exit_error:
return ret;
}
int main(int argc, char **argv)
{
int ret=1;
const char *device_name = NULL;
unsigned int loops = 0;
int nlines = 1;
printf("debut");
device_name = "gpiochip5"; // PORT F
unsigned int lines[]={6}; // pin 6
ret = hammer_device(device_name, lines, nlines, loops);
return ret;
}
Thank you.
