Tool/software: TI-RTOS
Hi,
I want write a interrupt program in C to deal with UART receive and send in the PRU. now where can I get the detailed introdution or a example?
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.
Tool/software: TI-RTOS
Hi,
I want write a interrupt program in C to deal with UART receive and send in the PRU. now where can I get the detailed introdution or a example?
Hi Nick,
Thabks for your answer.
But I want to know that how the PRU can handle the interrupt from its own peripherals.
Hello zhuangbin,
1) Do you want to use the UART in the ICSS, or the other UART?
2) Is the PRU doing anything other than controlling the UART?
Some sample code of the PRU controlling the ICSS UART can be found in the PRU_Hardware_UART project of the PRU Software Support Package. (Note that the PRU Software Support Package currently builds projects to have Linux-specific output files, but all the code for that project should work fine in RTOS).
The above example does not use the PRU INTC. Let me know if you do want to use interrupts in the PRU but are unable to find resources about it.
Regards,
Nick
Yes, I want to use the UART in the ICSS, and meanwhile, I hope PRU can do other things, such as it can response host command. so I hope uart protocols can be handled in the interrupt.
I've been studying the code of PRU_Hardware_UART.
I want to use interrupts in the PRU but I can not find resources about it.
Please help me.
Hello zhuangbin,
Quick background on PRU interrupts:
there are 64 system events in the INTC (interrupt controller). Those system events can be mapped to 10 channels. Those 10 channels are mapped to 10 host interrupts - host interrupts 0 and 1 are interrupts going towards the PRUs, while host interrupts 2-9 go towards the main host (ARM cores). Note that the PRU interrupts will not preempt currently running code. That is good because it means your PRU code is totally deterministic (you know exactly how long it will take everything to run), but it also means you must manually poll R30 to see if there is an event pending or not.
In Linux there are two ways to set up interrupts: allow the Linux RemoteProc system to configure INTC, or directly program the INTC registers in your PRU firmware. I do not know if RTOS provides a way to configure INTC, so I will point you to resources to program the INTC registers in your firmware code.
In the AM437x TRM, check out the "Interrupt Controller (INTC)" section. Pay particular attention to the "INTC Basic Programming Model" subsection. You will need to dig into the registers to configure in the "PRU_ICSS_INTC Registers" section.
For an example of interacting with PRU interrupts, see the PRU_IEP example of the PRU Software Support Package. Note that this example uses Linux to setup the INTC registers, so that will not help you. Also note that CT_INTC.REGISTER_NAME was defined in a header file in the include/ directory, so I do not expect you to be able to use it in RTOS. However, it shows how to check if a system event has been received, how to check which system event is received, and how to clear the event.
Regards,
Nick