Does TI offer a linux application utility that simply allows the user to write/read OMAP 35xx memory mapped registers? As helpful as this would be to OMAP developers, I'm hoping something may already exist.
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Does TI offer a linux application utility that simply allows the user to write/read OMAP 35xx memory mapped registers? As helpful as this would be to OMAP developers, I'm hoping something may already exist.
Thanks.
The attached utility should help. Below are the instructions.
1 – Introudction
The purpose of this document is to explain how to use a /proc function to read and write to registers on DaVinci/OMAP.
Here, commands issued on the host begin with host $ and commands issued on the target begin with target $.
2 – Installing the Code
Download the attached regrw.tar.gz to your working directory and extract the files. For example, if the download was saved to the directory /home/user/workdir/regrw, you would issue the following commands in a Linux prompt:
host $ cd /home/user/workdir/regrw
host $ tar -xzvf regrw.tar.gz
Next, modify the Makefile so that LSPDIR points to your LSP directory. For example, change
LSPDIR= <LSPDIR> to LSPDIR= /home/user/workdir/lsp/ti-davinci
Now, compile the code.
host $ make
This will create a regwr.ko file that should be copied to that target's file system. For example:
host $ cp regrw.ko /home/user/target
3 – Running the Code
To run the code, on the target, move to the directory where you placed the regrw.ko file, and install it. For example, if the file was placed in the target's root directory:
target $ cd /
target $ insmod regrw.ko
Now you should be able to read and write to registers.
To read from a register, issue a command of the form echo ADDR > /proc/regrw where ADDR is the hex address of the register to read. For example, to read from register 01c40000, issue the command
target $ echo 01c40000 > /proc/regrw
To write to a register, issue a command of the form echo ADDR DATA > /proc/regw where ADDR is the hex address to write to, and DATA is the data to write to that register. For example, to write 00000000 to register 01c72784, issue the command
target $ echo 01c72784 00000000 > /proc/regrw
When you are finished, remove the module.
target $ rmmod regrw
I'm using the OMAP35x EVM from Mistral so don't have an "lsp" directory. Do I just need to supply my kernel source dir?
Thanks.
I have a simpler utility that I have attached. You cross-compile and use it.
Steve K.
Along the same lines of controlling GPIO signals from linux, is using the Linux gpio api another way to do this? I had tried to use it but could not get it compile because I could not find the right #include file. If this is a good way to do this I would appreciate the proper include statement.
Thanks
Good news! You're both right!
Personally, I have a preference to use Juan's utility (which says it was written by David Meixner) because it accepts physical addresses (which are translated by the IO_ADDRESS() macro in the kernel).
Steve's utility should work just as well, but when you're accessing registers you'll have to translate the physical addresses documented in a data sheet (e.g., TRM) into virtual addresses before giving them to memutil.
I was looking for a utility to read/reade Omap3530 registers and found your code. It works most of times. But when I try to access the McSPI1 register it crashed, see the following:
omap3530# ./mem_util 0x48098000 w
/dev/mem opened.Unhandled fault: external abort on non-linefetch (0x1018) at 0x40020000
Memory mapped at address 0x40020000.
Any idea what causes the crash?
Thanks.
could you solve this issue? i'm having the same error while reading the timer registers. But while accessing the GPIO and MUX registers i'm facing no problems.
By the way, i'm using the regrw tool.
Edit: Nevermind. This error occurs if the functional-clock and/or the interface-clock for the corresponding timer are disabled. See TRM 493 and 494 for details on the registers
Just a quick question..
This regrw module does not currently compile cause there is no IO_ADDRESS macro. What has replaced the IO_ADDRESS macro in general and specifically the OMAP L138.
Thanks,
- Orlando
I am not able to find the IO_ADDRESS macro. What does it do and how do I add it in the program?
Pratik