Reload a PRU program while running

Hi!

Ok, now that I have a working DTO, I started to test my 32 channels servos driver PRU code.

I’m using pypruss to init all stuff, load firmware and so, but I’m unable to reload a new modified firmware (my firmware runs an infinite loop); pypruss stops on a segmentation fault on pru_write_memory()), or using exec_program()…

I plan to give it a try to the regular C API, but I wanted to know if there are some stuffs I should be aware of? Is it a pypruss issue, or a wrong usage?

I’m using this code:

`
import time

import pypruss

#pypruss.modprobe()

pypruss.init()

pypruss.pru_write_memory(pypruss.PRUSS0_PRU0_DATARAM, 0, 32*[1500])

pypruss.exec_program(0, “./pwm.bin”)

#pypruss.pru_disable(0)
pypruss.exit()

`

I don’t know what should be done only the first time, every time, etc…

Thanks,

Frédéric

If you read the TRM, it mentions the PRU program memory is only
accessible when the PRU is in reset. So you need to stop the PRU, and
_then_ you can upload a new program.

Note you can still leave the PRU running an infinite loop, the ARM
side has the ability to reset or shutdown the PRU with no coordination
or intervention required from the PRU side.

If you read the TRM, it mentions the PRU program memory is only
accessible when the PRU is in reset. So you need to stop the PRU, and
_then_ you can upload a new program.

And what about the write_memory()? It should work, no?

What are the parts of init stuff I should use/not use when the PRU is
running, if I want to interact with it?

Note you can still leave the PRU running an infinite loop, the ARM
side has the ability to reset or shutdown the PRU with no coordination
or intervention required from the PRU side.

I used the debugger, and only tried to halt the PRU; I'll try to reset it
from there to see if it works.

Thanks,

Ok, in fact, pypruss (prussdrv, I guess) seems to switch the PRU to reset
mode before sending the new firmware, when you call exec_program().

But the call to pypruss.open(0) is needed, in every case (even to write to
data memory).

This is great, I'm now able to load/modify and talk to my PRU firmware :o)

Thanks,