4 Replies Latest reply on Apr 22, 2016 5:49 PM by JacobT_81

    RTOS & i2c

    martin.schmid_1772271

      Hi all,

       

      we are using a BCM20737S on a custom PCB, and have another question left:

       

      From the comments in the forum, I assume the BCM20737S is using ThreadX as RTOS (please correct me if I am wrong) and that the custom code is only called from the RTOS when needed (on startup, on pairing, on a timer event, on an interrupt etc...).  Most of our tasks involve I2C communication and are very short and not sensitive to errors, so we never had problems. But if we would like to do some longer and timing-sensitive communication via I2C which takes around 10 seconds, is there a way to ensure the current function is not interrupted and the thread is not suspended during execution?

       

      (or are the I2C functions like cfa_bsc_OpExtended already giving a warranty that they are not interrupted during communication? An interrupt outside of the I2C transaction itself is probably easy to handle and likely very short).

       

      Thanks for any answer or thoughts.

        • 1. Re: RTOS & i2c
          JacobT_81

          Any operation that attempts to hold the CPU longer than 2 seconds will trigger the watchdog and reboot the system. Disabling the watchdog, while possible, is not recommended, will produce unpredictable behavior, and possibly seize up the system.

           

          Your best bet will be breaking up your i2c calls into chunks and allowing the CPU to carry out other tasks in the between calls. 

           

          Jacob

          2 of 2 people found this helpful
          • 2. Re: RTOS & i2c
            martin.schmid_1772271

            Does this mean, that a call to a user function is never interrupted or suspended, unless it is hitting the 2 second limit?

            • 3. Re: RTOS & i2c
              JacobT_81

              Individual i2c function calls are blocking operations. An individual i2c sequence will never be interrupted.

               

              Additionally, the user-level thread will be allowed to run until that 2-seconds is up. Whether the RTOS is running some operations concurrently, I can't yet speak on, but it's definitely not stopping the user thread.

               

              Jacob

              1 of 1 people found this helpful
              • 4. Re: RTOS & i2c
                JacobT_81

                To add to my earlier post, it turns out that the user thread will actually be interrupted by the BLE hardware for periods on the order of 300us. Although an individual i2c op won't be interrupted, you'll be interrupted in between i2c calls despite kicking the watchdog.

                 

                Again, I must warn you against holding the user thread. If in BLE connection, this will likely be detrimental to the system.

                 

                Jacob

                1 of 1 people found this helpful