Results 1 to 2 of 2
Hi,
I am using mmap() in user space to access SPI registers in the OMAP3530.
The physical address is 0x48098000 (OMAP_MCSPI1_BASE) which is the start of the McSPI1 registers. mmap ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-26-2010 #1Just Joined!
- Join Date
- May 2010
- Posts
- 2
crash when read/write mapped io registers
Hi,
I am using mmap() in user space to access SPI registers in the OMAP3530.
The physical address is 0x48098000 (OMAP_MCSPI1_BASE) which is the start of the McSPI1 registers. mmap works fine. But when I try to print out the register values I got
Unhandled fault: external abort on non-linefetch (0x101
at 0x4002100c Bus error
I have seen some posts which had the same issue but I haven't seen any reply or solution to it. Can anyone help please? Any suggestion would be appreciated.
Here is the code:
fd = open("/dev/mem", O_RDWR);
if (fd == -1)
{
printf("open() failed!\n");
return -1;
}
mmap_addr = mmap(NULL, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,mem_start);
if (mmap_addr == MAP_FAILED) {
printf("gpio mmap() failed!\n");
exit(1);
}
ptr = (unsigned int *)(mmap_addr) ;
printf(" 0x%08x mapped to %p (%p)\n", OMAP_MCSPI1_BASE, mmap_addr, ptr) ;
ptr+=4 ; // skip the first 4 registers and start from SCR register
printf("%p 0x08x\n", ptr, *ptr) ; ptr ++ ;
printf("%p 0x08x\n", ptr, *ptr) ; ptr ++ ;
...
I also tried similar code to map the GPIO registers, it worked fine and I could do read/write with those GPIO registers.
Many thanks.
- 06-02-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,160
Are you sure that the start address is a multiple of the system page size (usually 4 kbytes)?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
