Reading and Writing register i.MX6UL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading and Writing register i.MX6UL

Jump to solution
6,983 Views
pratyushtomar
Contributor IV

I want to read and write LPTAR register for my board using i.MX6UL processor to wake up board from shutdown state. Is their any sample code how to read and write register from userspace in yocto?

Labels (3)
1 Solution
4,145 Views
Carlos_Musich
NXP Employee
NXP Employee

For direct memory access Linux provides special node /dev/mem. You can try to write to registers directly using memtool included in imx-test package.


Basically You may look at memtool sources. Please note that accesses to non-supported address regions (hardcoded in /dev/mem driver) may cause system issues.

Supported registers may be shown using the next command

$ /unit_tests/memtool .

or

$ /unit_tests/memtool *

 For help

$ /unit_tests/memtool

You can find and exampl of usage in page 30 of next document.
http://www.freescale.com/files/32bit/doc/app_note/AN4576.pdf

To include this tool in your build you need to add IMAGE_iNSTALL_append = "imx-test" in the local.conf

After built succeed, unit_test can be found in build-6ul-x11/tmp/deploy/images/imx6ulevk/core-image-base-imx6ulevk.tar.bz2

If you want to access through you own c code you may check the sourcecode of memtool. Or here you can see an example.

Accessing CCSR from linux user space 


Best regards,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
4,146 Views
Carlos_Musich
NXP Employee
NXP Employee

For direct memory access Linux provides special node /dev/mem. You can try to write to registers directly using memtool included in imx-test package.


Basically You may look at memtool sources. Please note that accesses to non-supported address regions (hardcoded in /dev/mem driver) may cause system issues.

Supported registers may be shown using the next command

$ /unit_tests/memtool .

or

$ /unit_tests/memtool *

 For help

$ /unit_tests/memtool

You can find and exampl of usage in page 30 of next document.
http://www.freescale.com/files/32bit/doc/app_note/AN4576.pdf

To include this tool in your build you need to add IMAGE_iNSTALL_append = "imx-test" in the local.conf

After built succeed, unit_test can be found in build-6ul-x11/tmp/deploy/images/imx6ulevk/core-image-base-imx6ulevk.tar.bz2

If you want to access through you own c code you may check the sourcecode of memtool. Or here you can see an example.

Accessing CCSR from linux user space 


Best regards,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------