*1 Most important what's it doing?*
The original post was a link to all the code.  It is 
at: https://gitlab.com/brucechidester/pru-messaging-example
The Readme.txt file explains what I would like the solution to do.
 
*2 This is the BB AI correct?*
I do not know what this question means..please clarify. 

*3 Where did this code come from?*
I wrote this code from other examples attempting to get it to work. 
 
*4 What is your ARM OS and version. Compiler host  details*
BeagleBoard.org Debian Buster IoT Image 2020-04-06,  4.19.94-ti-r42.  A 
fresh release from https://beagleboard.org/latest-images
 
*5 Brief Summary of what you tried  with important details(start from 5 and 
work backwards trying to keep it clear and concise)*
I was trying several examples from everywhere and I cannot get any 
messaging example to work.  The TI messaging examples that they provide do 
not include the application code that interacts with the PRU messaging. The 
UIO to Remote Proc change has made many of the examples out of date and it 
is getting frustrating trying to figure out the correct solution for the 
latest disto for the BBB. 

On Monday, May 24, 2021 at 12:13:30 PM UTC-5 lazarman wrote:

> Hello Bruce in my opinion your missing some things important 
>
> 1 Most important what's it doing?
> 2 This is the BB AI correct?
> 3 Where did this code come from?
> 4 What is your ARM OS and version. Compiler host  details
> 5 Brief Summary of what you tried  with important details(start from 5 and 
> work backwards trying to keep it clear and concise)
>
> Sent from Yahoo Mail on Android 
> <https://go.onelink.me/107872968?pid=InProduct&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers&af_wl=ym&af_sub1=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature>
>
> On Mon, May 24, 2021 at 10:44 AM, Bruce Chidester
> <[email protected]> wrote:
>
> Maybe some code in the post will promote some response:
>
> *Main Application:*
>
> #include <stdio.h> 
> #include <pruss_intc_mapping.h> 
> #include <prussdrv.h> 
> #include <poll.h> 
> #include <sys/stat.h> 
> #include <fcntl.h> 
> #include <unistd.h> 
> #define DEVICE_NAME "/dev/rpmsg_pru30" 
> int main(int argc, char* argv[]) { 
>    int result = 0; 
>    struct pollfd pollfds[1]; 
>    pollfds[0].fd = open(DEVICE_NAME, O_RDWR); 
>    if (pollfds[0].fd < 0) { 
>       printf("Failed to open %s\n", DEVICE_NAME); 
>       return -1; 
>    } 
>    /* Send 'hello world!' to the PRU through the RPMsg channel */ 
>    result = write(pollfds[0].fd, "hello world!", 13); 
>    while (1) {    
>       prussdrv_pru_wait_event(PRU_EVTOUT_0); 
>       printf("Responding to interrupt\n"); 
>       prussdrv_pru_clear_event(PRU_EVTOUT_0, PRU0_ARM_INTERRUPT); 
>    } 
>    return 0; 
> } 
>
> *PRU Code:*
>
> #include <stdint.h> 
> #include <pru_cfg.h> 
> #include <pru_intc.h> 
> #include "resource_table_empty.h" 
> volatile register uint32_t __R30; 
> volatile register uint32_t __R31; 
> #define PRU_ARM_INTERRUPT 19 
> #define HOST_NUM 2 
> #define CHAN_NUM 2 
> #define PRU_ARM_INTERRUPT_PULSE 0x23 
> #define HOST_INT ((uint32_t) 1 << 31) 
> // PRU Interrupt control registers 
> #define PRU_INTC 0x00020000 
> // Start of PRU INTC registers TRM 4.3.1.2 
> #define PRU_INTC_GER ((volatile uint32_t *)(PRU_INTC + 0x10)) 
> // Global Interrupt Enable, TRM 4.5.3.3 
> #define PRU_INTC_SICR ((volatile uint32_t *)(PRU_INTC + 0x24)) 
> // Interrupt, TRM 4.5.3.6 
> #define PRU_INTC_GPIR ((volatile uint32_t *)(PRU_INTC + 0x80)) 
> // Interrupt, TRM 4.5.3.11 
> void main(void) { 
> /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */ 
> CT_CFG.SYSCFG_bit.STANDBY_INIT = 0; 
> // Globally enable host interrupts 
> CT_INTC.GER = 0x1; 
> /* Clear any pending PRU-generated events */ 
> __R31 = 0x00000000; 
> /* Enable Host interrupt 2 */ 
> CT_INTC.HIEISR |= HOST_NUM; 
> //Enable the system event to be propagated through the INTC 
> CT_INTC.EISR |= PRU_ARM_INTERRUPT; 
> /* Map channel 2 to host 2 */ 
> CT_INTC.HMR0_bit.HINT_MAP_2 = CHAN_NUM; 
> /* Map PRU0_ARM_INTERRUPT (event 19) to channel 2 */ 
> CT_INTC.CMR4_bit.CH_MAP_19 = CHAN_NUM; 
> /* Ensure PRU_ARM_INTERRUPT is cleared */ 
> CT_INTC.SICR = PRU_ARM_INTERRUPT; 
> volatile uint32_t gpio; 
> /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */ 
> CT_CFG.SYSCFG_bit.STANDBY_INIT = 0; 
> gpio = 0x000F; 
> while (!(__R31 & HOST_INT)) { 
> } 
> while (1) { 
>    __R30 ^= gpio; 
>    __delay_cycles(1000000000); 
>    __R31 = PRU_ARM_INTERRUPT_PULSE; 
>    // Clear interrupt 
>    CT_INTC.SICR = 15; 
>    } 
> } 
>
> On Sunday, May 23, 2021 at 2:10:24 PM UTC-5 Bruce Chidester wrote:
>
> Group,
>
> I have been attempting to make a messaging example and I am either very 
> close or so far away I don't realize it since I cannot seem to get it to 
> respond.
>
> Once I get it working I will leave the answer for the world, please help 
> me get this example working.
>
> It is at: https://gitlab.com/brucechidester/pru-messaging-example
>
> In summary, it is the smallest possible example where the application code 
> sends an interrupt (or message) to the PRU and the PRU sends an interrupt 
> every second (with a GPIO pulse). Every time the pulse is sent from the 
> PRU, the main application prints a message.
>
> Thanks in advance.
>
> -- 
> For more options, visit http://beagleboard.org/discuss
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
>
> https://groups.google.com/d/msgid/beagleboard/176deb85-62a7-4370-890a-c7ae7873d168n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beagleboard/176deb85-62a7-4370-890a-c7ae7873d168n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/93fad70d-2bb5-4593-ae4d-f2ac02bf3ba3n%40googlegroups.com.

Reply via email to