07-16-2019 05:17 AM
With Zynq-7000 I was able to read certain registers from the USB controller with a user space program to determine when a USB plug event happened. This program ran in the background and would load or unload a user space program based on the plug event.
I am now using Zynq UltraScale+ and the same type of direct access no longer works. I am assuming due to the new/added security features.
The above is one example where I need access to a register in one of the ARM's peripherals. Another example is adjusting the ARM's I2C dividers to change I2C bus speed.
Looking for suggestions on how I should go about getting access to these registers again, ideally from user space.
Thanks in advance.
07-17-2019 02:42 AM
If you say User space, I presume you are talking about Linux.
Basically you want an event driven alert if an USB device is plugged in. Linux does not work with interrupts as it is a preemptive OS. ( with a scheduler )
Things you can do:
$ lsusb | wc 6 62 366 $ lsusb | wc 7 72 436
You have plenty of tools already available inside linux but you can also develop with a custom user space C or Python application.
As for the I2C speed settings, I think you better change the device tree to your needs. There is already a parameter for altering the speed.
Now the experimental answer:
Here is an example tool : devmem2
This alows you to straigth hack your way into the device tree binaries. The devicetree itself is in fact a layout or map so the kernel finds its pheriperals.
07-17-2019 08:27 AM
Thanks for the responses. Yes, this is Linux.
I need changing I2C speed to be dynamic, i.e from the command line, and not static as with devicetree.
lsusb assumes I am using the USB port in host mode, I am using it in device mode. Unfornatully I do not have an external VBUD detect circuit as I've been able to read the USB controller directly.
devmem2 has the same issues as mmap to these memory locations. the system will hang when accessing 0xFF020000 (I2C0) for example.
07-17-2019 08:43 AM
I2C: The driver itself needs to configure the I2C bus speed at boot time so If you can alter the driver in such a way it opens a virtual file / folder you can set the bus when you echo a corrected speed into it.