1 Reply Latest reply on Apr 11, 2020 2:57 AM by GaneshD_41

    DECT reset/wakeup

    MiAr_4610906

      What's the correct way to reset and wake up a DECT module? Something like this?

       

      void resetDect() {

             REST_DECT_Write(0);

      CyDelay(10);

      REST_DECT_Write(1);

      }

       

      void wakeupDect(void) {

        Wakeup_DECT_Write(0);

      CyDelay(10);

      Wakeup_DECT_Write(1);

      }

       

      There's a comment attached to both Cypress "_Write" functions:

       

      If you use read-modify-write operations that are not atomic, the Interrupt Service Routine (ISR) can cause corruption of this function. An ISR that interrupts this function and performs writes to the Pins component data register can cause corrupted port data. To avoid this issue, you should either use the Per-Pin APIs (primary method) or disable interrupts around this function.

       

      How can we tell whether an ISR writes to the Pins component data register? What’s the “Per-Pin API”, and should we use it? Should we disable interrupts around the function calls?

        • 1. Re: DECT reset/wakeup
          GaneshD_41

          Hi,

           

          Any functions which are running in the main function (thread mode) will be pre-empted by the Interrupt service routines (Handler mode).

           

          So it is a general recommendation to ensure that the function being executed will not be corrupted by the pre-emption of Interrupts and their routeines if both the functions as well as interrupts access same peripherals. Please note that it is not in every case that ISR will corrupt the function that is being executed. In certain cases like printing a string in function will be interrupted by printing in the ISR.

           

          If the time taken for the execution of the function is high and if you expect any ISR that writes to the same pin we recommend you make it as less as possible by removing extra wrapper functions.

           

          Also you can call the API CyEnterCriticalSection() which disables all the interrupts and CyExitCriticalSection() enables the interrupts back.

           

          The per pun API can be found in the System reference guide for the PSoC attached.

           

          Thanks

          Ganesh