3 Replies Latest reply on May 22, 2020 10:41 AM by ivangalysh

    Odd PRU interrupt behavior

    ivangalysh

      I want to determine if I can use the PRUs to interact with an instrument for a satellite payload. I am able to get rpmsg-proc working and can move blocks of data quickly enough. I added the IEP timer and want to set it up to generate a 1 second interrupt so I can set a flag in the data indicating end of 1 second integration. My test code is supposed to send a message once a second triggered by the timer. Instead I am getting two messages every two seconds. I modified resource_table1.h to map event 7, IEP compare event, to host 1 which is R31 bit 31. I am using PRU1. Attached is the code. Any help would be appreciated.

       

      I'm hoping to use the BBB industrial version in two space missions.

       

      Ivan

        • Re: Odd PRU interrupt behavior
          shabaz

          Hi Ivan,

           

          I didn't check all the code, but at first glance this looks incorrect:

          CT_IEP.TMR_CMP0 = 0x20000000; // set compare to 1 second at 200 MHz
          

           

          At 200 MHz clocking, this would be a delay of just over 2 seconds (2.68 seconds). If you wish it to be 1 second then this is not the right value.

          It should be 200000000 (or just type (int)2E8 it is easier to follow or (int)200E6), not 0x20000000

          Also, for space stuff (or any coding), these constants should be defined elsewhere, not in the function, and someone can then check each one.

          2 of 2 people found this helpful
          • Re: Odd PRU interrupt behavior
            ivangalysh

            I finally figured it out. I needed to set CT_INTC.SICR = 7 to clear out the event.

            After line 117,

            CT_INTC.SECR0 = 0x80; I added

            CT_INTC.SICR_bit.STS_CLR_IDX = 7;

             

            This took care of it.

             

            I have my code working. Now to work on the physical interface.


            Ivan

            2 of 2 people found this helpful