*Hi All, *

My next goal is to have a have a C program on the *Main processor read and 
write values into -> PRU Memory*.   There are plenty of examples about this 
however they are not returning my register values.   Indeed I am able to 
read/write somewhere and persist value into PRU memory. Successive program 
runs which implement a counter seem to work, but I am guessing that my 
understanding of the start address for what I think I am writing /reading 
is wrong.  I would call it half working.   On the Flip side , inside the 
PRU I have a simple Assembly program that has a counter and various static 
values in other R1,2,3,4,5,6,7  etc to signal to me that I am accessing the 
right registers form the C program.    Note that the two counter loops are 
decoupled. The first one was just used for testing.

Here is my basic understanding - Focusing on PRU0:

Each PRU has 8K of  'dataram'  - This is where I expect  R1,R2,R3 ---- R31 
to be stored.    * Is this true? I see many people changing the reference 
at *0x0000_0n00, n = c24_blk_index[3:0],   do I need to set where the Rn's 
lay down in memory?

Note that in one of my assembly registers R2 I have an value that 
determines the speed of a blinking LED.   For all intents let's pretend I 
want to change that value.

Moving on.


*prussdrv_map_prumem(PRUSS0_PRU0_DATARAM, &sharedMem);sharedMem_int = 
(unsigned int*) sharedMem;*

Looking at the above C code - this appears universal in the examples.   Get 
an array pointer to the allocated PRU memory  *PRUSS0_PRU0_DATARAM.*

Since in my PRU assembly program I have Registers set everywhere to values 
I will recognize I would expect to see my values when calling:

result_0 = sharedMem_int[0];
result_1 = sharedMem_int[1];
result_2 = sharedMem_int[2];
result_3 = sharedMem_int[3];

etc...    

Printing these out do not reflect the values I am setting and using in the 
PRU.

So now we must be entering into a world of offsets.   We must be reading 
some other address space,

I did see alternative examples that an offset  was used like 
sharedMem_int[OFFSET 
+1];  but that I am sure had more to do with the Shared memory area of 12K 
ram.

Should the registers be available as I have described?
Do I need to do anything in the assembly to allow the C program into the 
general Rn registers?
Do general Rn registers need an offset?   
Does the assembly need to set a pointer for where the general registers get 
written?  When R1 is set for example does it look for a base address in the 
constants table?

Docs also state that the PRU 0 Data ram starts at  *0x4a300000*;

    int registerStart;
    registerStart = *(int*)0x4a300000;
    printf("--> R0 = %d" + registerStart); 

However I get a seg fault trying to print what is in R0 that way.  That was 
more to just do a direct look see if possible and go around all the 
interfaces.  

<https://lh3.googleusercontent.com/-Gn9n5rp4phY/WDnhrgk3Y_I/AAAAAAAAAR4/Jb7pB6n_WAM_JcPk36ocz4xu_u6uyK1PwCLcB/s1600/Screen%2BShot%2B2016-11-26%2Bat%2B12.24.39%2BPM.png>

<https://lh3.googleusercontent.com/-4P95j2oiKkQ/WDniNpAt5TI/AAAAAAAAAR8/WQDtAvNlaac9H9KSklkCmxq6qAf0ayDygCLcB/s1600/Screen%2BShot%2B2016-11-26%2Bat%2B12.27.31%2BPM.png>


<https://lh3.googleusercontent.com/-PHlFvI12zYs/WDnitVNFEwI/AAAAAAAAASA/BdR5tWZmEOMgA5QXS6Lf_wPd1UOV6FxAACLcB/s1600/Screen%2BShot%2B2016-11-26%2Bat%2B12.29.12%2BPM.png>

 


-- 
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 beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/5a78aa19-7855-4083-b620-965d793c7cae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to