dinuxbg / pru-gcc-examples

Simple example projects for PRU-GCC
49 stars 12 forks source link

Regarding the hc-sr04-range-sensor code #8

Closed deebot closed 4 years ago

deebot commented 4 years ago

The README.md says "reboot # Needed to load the firmware" after copying the firmware to /lib/firmware. Why is a reboot needed , i didnot see this in any other example that a reboot is required. Whats special going on here. Secondly it is also not clear how to look at the values on the arm side.

dinuxbg commented 4 years ago

Why is a reboot needed , i didnot see this in any other example that a reboot is required. Whats special going on here.

Because when the example was written, Beagleboard kernel required a reboot to reload remoteproc firmware. Feel free to update the instructions if you can test your new steps.

Secondly it is also not clear how to look at the values on the arm side.

Instructions are in the README: To see the range measurement result in millimeters:

    sudo bash
    echo hello > /dev/rpmsg_pru31
    cat /dev/rpmsg_pru31   # Press Ctrl+C to exit
deebot commented 4 years ago

Ah i see the problem for me was that since i dont have a HC-sr04 sensor the way it is handeled is, that it waits for the echo back. That why i think i just see a hello and nothing else. when i cat the rpmsg_pru31. However i am trying to write a LKM that can take data as input from userspace application and then writes this data on the memory location. Any pointers on how should i achieve this. Final question does this code stores the data in the shared RAM inside PRUSS i couldnot see any reference to base address

dinuxbg commented 4 years ago

However i am trying to write a LKM that can take data as input from userspace application and then writes this data on the memory location. Any pointers on how should i achieve this.

You can send small chunks of data using RPMSG. This is the "echo hello > /dev/rpmsg_pru31" line from the README.

For bigger chunks you need to allocate DMA or CMA memory on kernel side.

Final question does this code stores the data in the shared RAM inside PRUSS i couldnot see any reference to base address

All globals and large stack variables are stored in PRU Data SRAM. Check the linker scripts.