Beaglebone Green - Remoteproc dynamic firmware change. Module in Use Error.

Hi All, wishing everyone success in 2017!

Last night I was working on an automation routine for the green version and saw all the remoteproc stuff was in place, so I decided to move towards the remoteproc method of interacting with the PRU.

I was able to get the TI PRU Sample code compiled and the CGT clpru installed and run it the firmware build. However I need to reboot the board everytime for it to load the firmware file. I need to be able to make code changes, compile, and reload like I did with uio_pruss.

The searching I have read states that a simple removal and loading of the remoteproc module does the loading process as well from /lib/firmware.

I am receiving the message FATAL module is in use.

I tried unloading other “in use” other modules but still got the same message.

Any ideas why or what locks a module from being reloaded or removed?

Neil

I’ve never seen the FATAL error.

The following should work:

rmmod pru_rproc
modprobe pru_rproc

The above commands remove the remote proc kernel module, and then reinserts it.
Your revised firmware should be loaded after executing the modprobe command.

You will need root access or sudo prefix to the above commands.
What distribution are you using?

Regards,
Greg

Hi Greg,

root@beaglebone:~# rmmod pru_rproc
rmmod: ERROR: Module pru_rproc is in use

or

root@beaglebone:~# modprobe -r pru_rproc
modprobe: FATAL: Module pru_rproc is in use.

I am using kernel 4.4.9-ti-r25 Debian 8.6

I did not flash a new image - this is straight out of the box. Do you know what the mechanism is that blocks the module remove in the OS?

Neil

OK this worked:

root@beaglebone:~# rmmod -f pru_rproc

I added the -f and it forced it out. Thx!!!

Neil

Interesting. On more recent distributions I did not have to use the -f option.
In some earlier TI documentation, rmmod -f was the recommended method to remote the PRU RemoteProc module.
But there have been changes since then and the PRU RemoteProc framework has continued to mature.

Please see the documentation in this project for another method to control RemoteProc from sysfs in user-space:

https://www.hackster.io/Greg-R/pru-pid-motor-speed-controller-with-beaglebone-green-ccb805?ref=search&ref_id=remoteproc&offset=1

Follow the link to the github repository. The documentation is in the doc directory. Look for the PDF file.
Also there is a link to ZeekHuge’s github repository where you can find more information.

Regards,
Greg