I just noticed the faster way of toggling pins by using mmap, and after trying chiragnagpal's example, I could achieve 2.6MHz.
Example was for 1 pin only, now I want to use 8 pins, so I edited .dtc file as following:
/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Purpose License Version 2 as
* published by the Free Software Foundation
*
* Original from: github.com/jadonk/validation-scripts/blob/master/test-capemgr/
*
* Modified by Derek Molloy for the example on www.derekmolloy.ie
* that maps GPIO pins for the example
*/
/dts-v1/;
/plugin/;
/{
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "DM-GPIO-Test";
version = "00A0";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pinctrl_test: DM_GPIO_Test_Pins {
pinctrl-single,pins = <
0x070 0x07 /* P9_11 60 OUTPUT MODE7 - The LED Output */
0x078 0x07 /* P9_12 60 OUTPUT MODE7 - The LED Output */
0x074 0x07 /* P9_13 60 OUTPUT MODE7 - The LED Output */
0x048 0x07 /* P9_14 60 OUTPUT MODE7 - The LED Output */
0x040 0x07 /* P9_15 60 OUTPUT MODE7 - The LED Output */
0x04c 0x07 /* P9_16 60 OUTPUT MODE7 - The LED Output */
0x15c 0x07 /* P9_17 60 OUTPUT MODE7 - The LED Output */
0x158 0x07 /* P9_18 60 OUTPUT MODE7 - The LED Output */
/* OUTPUT GPIO(mode7) 0x07 pulldown, 0x17 pullup, 0x?f no pullup/down */
/* INPUT GPIO(mode7) 0x27 pulldown, 0x37 pullup, 0x?f no pullup/down */
>;
};
};
};
fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_test>;
status = "okay";
};
};
};
};
However I could not figure out how to edit the header file used in the example. Here is the header file of the example:
#ifndef _BEAGLEBONE_GPIO_H_
#define _BEAGLEBONE_GPIO_H_
#define GPIO1_START_ADDR 0x4804C000
#define GPIO1_END_ADDR 0x4804DFFF
#define GPIO1_SIZE (GPIO1_END_ADDR - GPIO1_START_ADDR)
#define GPIO_OE 0x134
#define GPIO_SETDATAOUT 0x194
#define GPIO_CLEARDATAOUT 0x190
#define PIN (1<<28)
#endif
Questions:
1) I could not find START_ADDR, END_ADDR, OE, SETDATAOUT, CLEARDATAOUT from technical manual. Where can I find them for the pins from P9_11 ... upto P9_18
2) what is the explanation of the following statement? What does it do?
3) I am going to use it for SPI communication, so since the timing is critical, and Linux is not RT, there is a possibility that some other interrupts may damage my communaction. Do you think that it would be a problem? If yes, what precautions can I get?
Regards,
Frank