Wow. This is great. I like the problem/solution format. It really makes it easy 
to see which sections you might be interested in reading.

There is a typo on the first line of the Case Studies - Introduction that jumps out 
though: "It’s an excisting time"

And I wouldn't mind seeing a bit more of an explanation about how rpmsg works, 
for example a listing of resource_table_0.h with an explanation.


On 08/17/2018 09:58 AM, Mark A. Yoder wrote:
The PRU cookbook is nearing completion (more accurately, I'm running out of 
summer).

Here's a link https://markayoder.github.io/PRUCookbook/

I'm happy for any feedback you can give me.

--Mark

On Thursday, June 28, 2018 at 8:45:00 PM UTC-4, Neilh wrote:

    Ok thanks. I see I was think SHARED_RAM between the ARM-A8 and PRU0 and its 
actually shared between ARM PRU0 and PRU1. Ahhhh-lightbulb---hhhhh
    Many thanks for the evolving cookbook and detailed explanation- I have got 
a little lost at times digging through the manual - gosh I want to read all the 
PRU sections - I'd have paid gold  4weeks ago when I started using the PRUst!.
    If it becomes a book I'll be first in line to buy it :).
    The PRUs are a cool part of the BBB - and now I've got it working appears 
pretty simple.


    On Thu, Jun 28, 2018 at 12:59 PM Mark A. Yoder <mark.a...@gmail.com 
<javascript:>> wrote:

        Neilh:
          I've worked up some examples[1] for a PRU Cookbook that might help. 
I'm taking a similar approach to what you did, but I'm using DRAM0.  It 
shouldn't be hard
        to switch to shared RAM.

        --Mark

        [1] 
https://markayoder.github.io/PRUCookbook/05blocks/blocks.html#_controlling_the_pwm_frequency
 
<https://markayoder.github.io/PRUCookbook/05blocks/blocks.html#_controlling_the_pwm_frequency>

        On Wednesday, June 27, 2018 at 5:36:13 PM UTC-4, Neilh wrote:

            Oops I got it - it was sizing a pointer and not the struct.

            I'd be interested in anybody's comments on the use of the SHAREDRAM 
approach as it makes for a very simple one way api. I'm partly publishing this 
as a tutorial for anybody else - but its my first try at the PRU.

            Here is the logic anlayzer output from the Saleae 8 Channels 
mapping of PRU0 to GPIO P9_25 ...P8_12
            There is an increasing pulse count chn0, and then fixed 1hz, 2hz... 
on subsequent channels



            On Wed, Jun 27, 2018 at 2:13 PM Neil Hancock <neilh...@gmail.com> 
wrote:

                Oops  - you are right, I'll update my comments

                Here is the code that is allocating the SHAREDRAM - though I'm 
still hazy as to how mmap() works in BBB mapping the SHAREDRAM
                #define AM33XX_DATARAM0_PHYS_BASE0x4a300000
                #define AM33XX_DATARAM1_PHYS_BASE0x4a302000
                #define AM33XX_PRUSS_SHAREDRAM_BASE0x4a310000
                #define SHARED_RAM_SZ 16  /* grab 8*4 bytes or 8 words */

                volatile uint16_t *shared_dataram;

                /* Define an API to be calleable from JS -still needs work */

                void bbbio_ppm_api(struct channels_s *channels){
                   memcpy((void *)shared_dataram,(void 
*)channels,sizeof(channels));
                }

                void bbbio_ppm_init() {
                   /* Allocate shared memory pointer to PRU0 DATARAM */
                int mem_dev = open("/dev/mem", O_RDWR | O_SYNC);
                volatile void *shared_dataram_init = mmap(NULL,
                 SHARED_RAM_SZ,
                PROT_READ | PROT_WRITE,
                MAP_SHARED,
                mem_dev,
                AM33XX_PRUSS_SHAREDRAM_BASE
                );
                shared_dataram = (uint16_t *) shared_dataram_init;
                }

                void bbbio_ppm_cleanup() {
                munmap((void *)shared_dataram,SHARED_RAM_SZ); //njh guess at 
releasing it.
                }

                #ifdef MAIN_LOCAL
                void main() {
                unsigned int sec_i, chnl_j;
                unsigned int offset;
                   struct channels_s  channels;
                   volatile uint16_t *shared_dataram2;

                   bbbio_ppm_init();
                   uint16_t ppm =60;//actually
                offset = 0;
                channels.chn[offset].sr =ppm;
                printf("shared_datara2 = %p, offset=%d At init Read:", 
shared_dataram,offset);
                   shared_dataram2 = (uint16_t *) shared_dataram;
                for(chnl_j=0; chnl_j<8; chnl_j++) {
                printf(" %04d",  *shared_dataram2);
                 shared_dataram2++;
                 if (0x3 ==(chnl_j & 0x3)){printf("  ");}
                   }
                   printf("\n");
                   ppm =0;
                for(chnl_j=0; chnl_j<8; chnl_j++) {
                      channels.chn[chnl_j].sr=ppm;
                      ppm += 60;
                    }
                    //Fut - wait for ack from PRU and then init shared ram

                    //while (1)
                    {
                  ppm=60;
                  for(sec_i=0; sec_i<8; sec_i++) {
                     channels.chn[offset].sr +=ppm;
                  //memcpy((void *)shared_dataram,(void 
*)&channels,sizeof(channels));
                bbbio_ppm_api(&channels);
                  printf("Writing %04d Read:", ppm);
                  shared_dataram2 = (uint16_t *) shared_dataram;
                  for(chnl_j=0; chnl_j<8; chnl_j++) {
                     printf(" %04d",  *shared_dataram2);
                     shared_dataram2++;
                     if (0x3 ==(chnl_j & 0x3)){printf("   ");}
                         }
                         printf("\n");
                         sleep(1);
                  }
                }
                bbbio_ppm_cleanup();
                }

                #endif //MAIN_LOCAL

                On Wed, Jun 27, 2018 at 1:33 PM Dennis Lee Bieber 
<wlf...@ix.netcom.com> wrote:

                    On Wed, 27 Jun 2018 12:18:27 -0700, Neil Hancock
                    <neilh...@gmail.com> declaimed the
                    following:

                    > with 8*int16 (or 32bytes).
                    >
                            Pardon?

                            int16 is 2-bytes, 8*2 => 16 bytes

                    >Initially I tried 8*int32 (64bytes) but could only 
sucessfully use the
                    >first 5*int32(40bytes
                    >
                            Similarly, int32 is 4-bytes, 8*4 => 32; 5*4 => 20



--         Wulfraed                 Dennis Lee Bieber         AF6VN
                    wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ 
<HTTP://wlfraed.home.netcom.com/>

-- 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...@googlegroups.com.
                    To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/pvs7jdpvq34jft17pkpeljrk5p0scj487r%404ax.com
 
<https://groups.google.com/d/msgid/beagleboard/pvs7jdpvq34jft17pkpeljrk5p0scj487r%404ax.com>.
                    For more options, visit https://groups.google.com/d/optout 
<https://groups.google.com/d/optout>.

-- 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...@googlegroups.com <javascript:>.
        To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/a90eb811-c902-4a20-96fa-31e1b03abb5a%40googlegroups.com
 
<https://groups.google.com/d/msgid/beagleboard/a90eb811-c902-4a20-96fa-31e1b03abb5a%40googlegroups.com?utm_medium=email&utm_source=footer>.
        For more options, visit https://groups.google.com/d/optout 
<https://groups.google.com/d/optout>.

--
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 
<mailto:beagleboard+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/5ef1cbae-0e43-47dc-83b1-dead26d1645d%40googlegroups.com
 
<https://groups.google.com/d/msgid/beagleboard/5ef1cbae-0e43-47dc-83b1-dead26d1645d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
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/83a9bc78-de80-18a1-cc2f-45368e8ecc39%40lechnology.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to