Hello All, I have created a sample driver {derived from leds and pwm} to test gpio and a sample program to test the pin number, both are working perfect, Now in simple c program If i run make pin high and low continuous in while loop, in oscilloscope i get 382 khz freq. while people saying they can get 800-900khz of freq. People say use pwm, yes i am using pwm pin 24 of con4, but no luck. If i disable the pwm then also i get the same freq. can someone please tell me how can i get more frequency, is there any patch, certain modification in kernel? Please let me know. Thank You for your time and consideration.
GPIO Speed
Hello miniarm, Do you use OS or not, i'm using WinCE and using GPIO driver. I'm doing the same thing in C# and i can get a frequency arout 50MHz or more. By using the PWM, i can create 12.5MHz frequency
Hello Judau, Yes, I am using Linux image and GPIO driver, in c program I am constantly making pin high and low and measure speed in osicoloscope, I only get 382 khz, if i use the pwm then also no difference in freq. can you please guide on this? Thanks & Regards, miniarm
I'm so sorry,I'm using WinCE so i can't help you very much! did you read the arm920T datasheet? You can get more infos about hardware (registers, I/O...)then you'll know how to do. Good luck. Judau
Judau, Could you briefly explain the process for getting such high GPIO speeds with an intervening OS?. I have no WinCE experience, but based on my limited Linux experience that seems several orders of magnitude faster than I would have guessed. Thanks, Dave
A user space GPIO driver is going to be very slow if it relies on being serviced by the OS for each change. I don't recall what a jiffie is on this Linux, but typical is maybe 4ms or 250 per second. I'm working on (and seeking help with) a set of drivers that use DMA and can be configured to take or send data in bursts at various speeds right up to the memory bandwidth of 100MHz or better for digital I/O and SPI at max rate for chips like fast A/D converters. My own app is underwater acoustics with chirps from 150 to 250 KHz and they need to be oversampled. 2MHz quadrature sampling from two channels would be great and with data bursts of one or two seconds. I would collect about 4 MBytes of data every second. On the Mini2440 it needs to be logged to SD or networked to a bigger data collection point. On the 6410, there may be enough speed with the VPU to do real-time pulse compression with FFTs and greatly reduce the data. On the Mini210, I think the whole thing can be done on board and resulting synthetic aperture sonar images displayed as the boat moves. Perhaps Mini6410's --> Mini210. I'll start a topic on DMA drivers.
Dear Charles, using driver i configure gpio and from simple c code i am sending data on that pin and measure freq. on oscilloscope. can you please show me the path where i should heading, kernel code changes etc.. I want to drive a servo motor connected with gpio, if i get more speed, that will be much great. in driver GPB0 pin i am using as a pwm. I can come on skype if you're on skype too. Thank you for your time and consideration. --miniarm
With the drivers available now, I think the best way is to use something like an Arduino for your real-time servo control with distance, speed, etc. set by the Mini2440 over serial or I2C or ? -- Charlie
Hi Charles, Thank you for pointing me out there at Ardunio, but i want to use mini2440 board with gpio pin available on the board and wants to achieve output. driver works well and program is also complete, but it will be great if i can achieve little more frequency than 382 khz. please guide me on this, meanwhile i am trying to compile linux 2.6.39, look forward to hear from you soon. Regards, miniarm
Miniarm, what does: > People say use pwm, yes i am using pwm pin 24 of con4, but no luck. exactly mean? What did you try? Pin 24 at CON4 is GPG11 at the CPU. This pin can act as GPIO, external interrupt or clock input for timer 1. But not as PWM output. Use GPB0, GPB1, GPB2 or GPB3 instead. They can act as PWM outputs.
Juergen, my mistake, I use pin 31 of con4 that is GPB0 as pwm output. pwm output comes as per the application need, but i am not getting freq. above 382 khz, it will be great if somehow i can get max freq. arround 800-900 khz. with rt kernel no luck instead cpu responding very slow, i am now trying to get 3.1 kernel in board. please let me know if you have other solution in mind, or perhaps there must be other way which i don't know. please suggest me a correct way. regards, miniarm
Andre, If you know any kernel changes, perhaps need to apply patch or something else, then please let me know. my solution is working fine, but all i want to achieve more freq. as per Jaydeep said above and i am using driver and userspace c program to test the freq. -- miniarm
@Juergen, I installed 2.6.39 kernel without rt patch, system is running fine, but still not able to get a good freq. can you please help me out there? -- miniram
@dave, @juergen, Any solution for this problem? also i am facing problem with dm900 ethernet driver, i am getting very low speed with new kernel also got some error of 'wrong data' when ping from outside. --miniarm
@judau, No, Still not get success, also tried rt patched kernel, but no luck. Can you please help me out in this situation? or show me some path, perhaps..! regards, miniarm
miniarm, did you read the S3C2440 processor's user manual, chapter 10, how the PWM works in your CPU? The base clock of these PWM timers is the internal "PCLK" which runs mostly at 66 MHz. There are some dividers to scale down this frequency, but at the end, this frequency is used to generate your PWM output signal. And with a base frequency of 66 MHz you should reach your frequency requirements.
@Juergen, I've already known about that, but i want to shift data with high speed (around 20MHz) via port to another device! Can you help me? Thanks in advance! @miniarm If you can disable all threads and interrupts, it will be faster (the application runs on OS).
@Juergen, Thanks for the reply, but I've tried changing parameter of pwm in driver as per the mentioned in the sheet. Tried changes prescaler to 1/2 but no lucj, If i try non pwm pin let's say pin 9 of CON4, still I am getting only 382 KHz freq, and If i increase CONFIG_HZ value, my touch screen stop responding. @Judau, How can i disable all threads and interrupts? please advice. If i do cat /proc/interrupts it list only releiving intetturpt only like touch screen, timer, ethernet, watchdot, etc. Here is the output 30: 1485552 s3c S3C2410 Timer Tick 32: 0 s3c s3c2410-lcd 37: 0 s3c s3c-mci 42: 0 s3c ohci_hcd:usb1 43: 0 s3c s3c2440-i2c 51: 57812 s3c-ext eth0 60: 0 s3c-ext s3c-mci 70: 221 s3c-uart0 s3c2440-uart 71: 1270 s3c-uart0 s3c2440-uart 79: 0 s3c-adc s3c2410_action 80: 0 s3c-adc adc, s3c2410_action 83: 0 - s3c2410-wdt Can you please tell me which one should i disable in order to get max. freq at the same time touch screen should works well. thank you for your time in advance. regards, miniram
I think you'll have to mmap() the GPIO registers and write them from the userspace app. Performing a kernel call (even if it does nothing) uses up about 60 sequential CPU cycles, so if the CPU freq is ~450Mhz, you'll be able to call the kernel with at most ~7.5Mhz. If the call actually does something, this number will be reduced further. The bottleneck here is not the PCLK, but the FCLK and the kernel call itself.
AFAIK there is no support for mapping arbitrary memory addresses in C# (at least the .NET 3.5 framework doesn't support it and it is unlikely to be supported in the future). Maybe you could work around it by using an unmanaged library to do the GPIO business, though it looks like that the Win32 API only supports memory mapping of files, not arbitrary memory addresses :(
I've made a software in C that runs at 2MHz. Funny thing is that not all pins runs on same speed. GPM runs at 380Khz while GPQ runs at 2MHz. If you use both, system sets all at lower speed. Forgot about using sysfs GPIO implementation. Use mmap on /dev/me instead.
Friends I found the driver for servo on http://www.mahumi.limanowa.pl/video/9y6kIe9jpu8/mini2440-servo-control-f...,
i want to toggle on/off from 2 pin of port to more. If you have The gpio driver, please tell me about how to custome on gpio driver! Thanks in advance!
Here is how to toggle on/off but if you are running other application it would slow down the toggle http://www.youtube.com/watch?v=CpjgujlyQJQ