Announcement

Collapse
No announcement yet.

PWM affected by I2C on a RF200

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PWM affected by I2C on a RF200

    I have a RGB LED connected to a RF200. I also have some sensors and a RTC connected. I am using some of the code from Eric Ibarra's 2011 AtmelPWM.py program. When an I2C function is called, the LEDs change color or even go completely off for a second or two. It's very pronounced when the duty cycles are set below the max. At the same time, Portal gives the error; 'Did not get an expected response within timeout period from 'node''. This happens when using Portal and SnapConnect.

    What can I do to keep the LEDs at the specified levels when performing I2C functions?

    (This may be unrelated but I get the timeout error when rebooting the node and at startup, also)

    I have the Red,Green, Blue positives wired to GPIO_6, GPIO_5 and GPIO_2. The ground to pin 1 GND. The I2C SCL is at GPIO_18, SDA is at GPIO_17, I2C ground is on pin 24. I am using an RF266PC1 for the bridge. I believe my firmware is up to date.

    RF200P81_AES128_SnapV2.7.2.sfi
    RF266PC1_AES128_SnapV2.7.2.sfi

  • #2
    Not exactly sure what would cause this, but I suspect that SNAPcore uses one of the PWM timers as the baud rate timer for the software I2C. Perhaps Greg or Jason can chime in on this.

    Comment


    • #3
      I am using the 8 bit timers from the PWM program.
      Timer 1:
      global mode
      mode ^= 0x01
      # Setup Counter 1
      value = 0x18 # Fast PWM, TOP=ICR1
      value |= 0x01 # Setup clock source fosc/1
      poke(0x81,value)

      value = peek(0x80)
      value |= 0x02 # Fast PWM, TOP=ICR1
      poke(0x80,value)

      # Set ICR1 to 255
      poke(0x87,0x00)
      poke(0x86,0xFF)

      Timer 3:
      global mode
      mode ^= 0x01
      # Setup Counter 3
      value = 0x18 # Fast PWM, TOP=ICR1
      value |= 0x01 # Setup clock source fosc/1
      poke(0x91,value)

      value = peek(0x90)
      value |= 0x02 # Fast PWM, TOP=ICR1
      poke(0x90,value)

      # Set ICR3 to 255
      poke(0x97,0x00)
      poke(0x96,0xFF)

      Comment


      • #4
        gvoce or jamos Any suggestions?

        Comment

        Working...
        X