Ahh, very nice thought. It's incredible how unexpectedly useful these
specialized hardware blocks can be. Personally, I think I'd still want
to use the GPMC on a Panda. It just feels nicer.
Cheers,
- Ben
Ahh, very nice thought. It's incredible how unexpectedly useful these
specialized hardware blocks can be. Personally, I think I'd still want
to use the GPMC on a Panda. It just feels nicer.
Cheers,
- Ben
Richard Watts wrote:
Richard Watts wrote:
[snip]
240Mbps is only 80 MByte/s - my USB attached hard disc can do 30%
of that (admittedly on a Panda, but still).using these odd 3bit bytes?
Exactly. Why follow convention? Um. Oops.
Richard.
I couldn't find it mentioned anywhere in there either! Of course, it
is a 3700-page manual, so I could have missed it. I can see where a
clock derived from another clock derived from another clock .......
feeds the whole GPIO architecture, but they don't say anything about
how that affects the update rate of one GPIO pin.
Jon
Hmmm, that's a VERY interesting measurement! 26 MHz / 4.34 Mhz ~=
6 ! And, there are SIX GPIO banks on the OMAP CPUs.
So, I think that is the multiplexing rate right there, each clock
cycle updates one GPIO bank, then it moves on to the next bank.
Jon
May be Jon, interesting derivation from your side…
At least some logic behind it…
regards
mohit
Actually jon, what I found was … when I tried to get 20 KHz from PWM, I got 10 KHz…
Now because of some edge constraint, the value = (reqd pwm frequency / clock frequency) shall be less than 2 at least from the over flow value of the internal timer so i think here there is a division by three of the clock frequency that we can get i.e.
26 / 3 = 8.66667 MHz … now that should be the value i should get… but then i get it divided by 2 i.e. 4.3334 MHz… see my first statement…
Now this is my understanding… you can put some light to it…
regards
mohit
correction of error
I’ve gotten PWM running on the Beagle [1], but I’m only seeing about 4MHz out. It could be the ringing caused by my poor wiring is masking the higher frequencies.
–Mark
[1] http://elinux.org/EBC_Exercise_04_Pulse_Width_Modulation
Would be possible for you to share the file omap3530-pwm-1.1.tar. with me? I cannot download it from anywhere I need to implement PWM backlight display on a OMAP35xx based board and would appreciate it.
Thank you,
Gil
I am using GPTIMER_PWM_9 to generate a square wave. Following is my code
`
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#define MEMORY_BASE_ADDRESS 0x48000000
#define GPTIMER9_BASE_ADDRESS 0x49040000
#define GPTIMER9_PADCONF_REGISTER 0x2174/4
#define GPTIMER9_RELOAD_REGISTER 0x002c/4
#define GPTIMER9_COMAPARATOR_REGISTER 0x0038/4
#define GPTIMER9_CONTROL_REGISTER 0x0024/4
#define GPTIMER9_COUNTER_REGISTER 0x0028/4
int main(void)
{
int config_fd, j, pwm_fd;
volatile unsigned int *config, *pwm;;
config_fd = open("/dev/mem", O_RDWR | O_SYNC);
printf (“Open file descriptor for PADCONFIG\n”);
if (config_fd < 0)
{
printf(“Could not open PADCONFIG memory fd\n”);
return 0;
}
// Pad configuration
printf (“Setting PAD configuration register\n”);
config = (unsigned int*) mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, config_fd, MEMORY_BASE_ADDRESS);
if (config == MAP_FAILED)
{
printf(“Pinconfig Mapping failed\n”);
close(config_fd);
return 1;
}
printf (“Setting padconf register for PWM\n”);
config[GPTIMER9_PADCONF_REGISTER] = config[GPTIMER9_PADCONF_REGISTER] & 0xffff0000 | 0x00000002; // setting 0x48002714 as gpt9_pwm_evt
printf(“The pin has been succesfully selected as gpt9_pwm_evt\n”);
close(config_fd);
printf (“Opening file descriptor for PWM\n”);
pwm_fd = open("/dev/mem", O_RDWR | O_SYNC);
if (pwm_fd < 0)
{
printf(“Could not open GPIO memory fd\n”);
return 2;
}
printf (“Memory opened for pwm settings\n”);
pwm = (unsigned int*) mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, pwm_fd, GPTIMER9_BASE_ADDRESS);
if (pwm == MAP_FAILED)
{
printf (“PWM Mapping failed\n”);
close(pwm_fd);
return 3;
}
printf (“Setting up PWM\n”);
pwm[GPTIMER9_CONTROL_REGISTER] = 0;
pwm[GPTIMER9_RELOAD_REGISTER] = 0x0000ff; // initial value of pwm during overflow
pwm[GPTIMER9_COUNTER_REGISTER] = 0x0000ff; // initial value of pwm during overflow
pwm[GPTIMER9_COMAPARATOR_REGISTER] = 0x0fffff; // overflow value
pwm[GPTIMER9_CONTROL_REGISTER] = 0x18c3; //timer control register
printf (“PWM Started\n”);
close(pwm_fd);
return 0;
}
`
But I am getting an error as follows
`
root@localhost:/home/dell/sample_programs# ./a.out
open file descriptor for PADCONFIG
map PINCONFIG
Setting padconf register for PWM
The pin has been succesfully selected as gpt9_pwm_evt
opening file descriptor for PWM
Memory opened for pwm settings
setting up pwm
Bus error
`
Can anybody help me to fix this issue?
Is it possible that your pwm is an array of ints, and you're indexing
it by byte offsets?
I think pwm[OFFSET] is referring to pwm+4*OFFSET, whereas you need pwm+OFFSET
I think PWM is an array of integers. If I give pwm+offset, then it will be equivalent to pwm + 4 * offset. Thats why I gave pwm+offset/4 for the correct index of array. Isn’t that correct.
Hi Mark,
It would be helpful if you could share the code to get PWM correctly?