This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3358: PRU RPMsg question

Part Number: AM3358

Tool/software: Linux

I am using RPMsg for communication between a Linux kernel module and the PRU. To help with debugging I have the PRU echoing all received commands back to the ARM core. I then use printk from the rpmsg callback to log all traffic between the cores. I don't send many messages back and forth but in some instances the PRU will send multiple messages in close proximity. Occasionally I am seeing messages that don't get printed. However when this happens I can send another message to the PRU (which gets echoed back to the ARM core) which will cause the missing message to print.

Does anything prevent the ARM side from servicing all available messages sent by the PRU?

On the PRU you loop in place to consume all available messages doing something like:

while (pru_rpmsg_receive(&transport, &src, &dst, payload, &len) == PRU_RPMSG_SUCCESS) {
	/* message parsing */
}


On the ARM side with Linux you use register_rpmsg_driver() and provide a callback function that gets executed when the PRU interrupts the ARM core. Given the way drivers/rpmsg/rpmsg_pru.c and samples/rpmsg/rpmsg_client_sample.c are are structured it looks like you will only ever get one message per callback. Does the Linux side of the RPMsg framework do any looping under the hood to consume all available messages or is this strictly a one to one relationship between callback and interrupt?

  • Hello Andrew,

    Let me check on this and get back to you.

    Regards,
    Nick
  • Hello Andrew,

    * Are you using interrupts or mailboxes to send the kicks?
    * Could you try adding delay on either the ARM or PRU sides to see if that changes your results?

    On multiple messages per callback:
    The virtio-rpmsg stack supports multiple messages per kick - see rpmsg_recv_done() in drivers/rpmsg/virtio_rpmsg_bus.c. So the Linux side should consume all available messages when it receives a kick from the PRU.

    On a message not printing until the next message is sent:
    If using interrupts, a register gets written when the kick is sent, and then Linux clears the register when the kick is addressed. Perhaps you have something going on where message/kick 1 clears the interrupt register after message/kick 2 already wrote to the register? If that was the case, I'd expect that you wouldn't see message 2 until message/kick 3 occurs, and then both message 2 and message 3 are read.

    Regards,
    Nick
  • Nick,

    Thank you for the response. I am using interrupts to send the kick so I may be seeing what you described. I will add some delay on the PRU side and see if that helps.