No announcement yet.

V4 PWM firmware update

  • Filter
  • Time
  • Show
Clear All
new posts

  • V4 PWM firmware update

    Firmware Update

    1. Hold down the red button, plug in USB/power
    2. Run PDFSUSB.exe
    3. Pick the board from the drop-down list
    4. Open the included hex file
    5. Program
    6. Execute
    7. Test with MDX or with Sample VB App


    Software PWM: XX is in milliseconds and YY is in percent on-time
    <iochannel id="Digital Output 0" port="15" brain="my fusion brain 0" type="digital_output">
    <defaults defaultstate="off"></defaults>
    <options mode="standard">
    <pulse duty_cycle="XX" period="YY"></pulse>

    Hardware PWM: XX is between 0 and 127 (off to on)
    <iochannel id="Digital Output 0" port="15" brain="my fusion brain 0" type="digital_output">
    <defaults defaultstate="off"></defaults>
    <options mode="pwm">
    <pulse duty_cycle="XX"></pulse>

    Sample non-MDX App to Control FB

    Move the sliders back and forth.

    Let me know if there's any issues.

  • #2
    Cant get to it, wants user name/password - used email addy/password used on your site and it wont let me in, also tried screen name/password from here - how can I get to it

    If anyone gives me a rev - I give them the Bird


    • #3
      oh woops

      try now


      • #4
        When I boot up the FB with the red button held down, my machine recognizes it as a v3 board, and outputs 9 and 10 oscillate at about 5 Hz. The PDFSUSB utility doesn't show anything in the drop down list.


        • #5
          Should show this in device manager

          With this as a driver:



          • #6
            bootloader driver:



            • #7
              Ah, much better. After I booted up the PIC in firmware mode (with the two oscillating outputs), I went into device manager and updated the driver to the bootloader driver. Once that was done, the update utility saw the device, and the firmware flash went exactly as expected. The update took only a couple seconds, and the PIC rebooted as a v4 FB.

              Now using FBDemo to check it out, and the sliders do control the brightness of the LEDs. However, the buttons no longer turn the outputs on and off. What changed in the byte stream? Are you using all 8 bits of the first byte for the PWM value, or are you only using 7 like the earlier details indicated?


              • #8
                the buttons turn them on now. To be off, the slider needs to be full left, and the output off. does it work like that for you?


                • #9
                  According to the data stream spec posted by 2k1, the first 7 bits are for PWM value (controlled by the slider), and the last bit is the on/off value, (controlled by the red/green button). Based on what I see, it looks like you are using all 8 bits for PWM value.

                  If that is the case, what is now in the second byte? There was a bit there to toggle between on/off mode and PWM mode.

                  I intended for the buttons to turn the output on/off, regardless of what the slider is set to.


                  • #10
                    the buttons turning the output on/off regardless of the slider doesn't make sense. If that's true, and you set the output to off, slider to full, the output would still stay off.

                    the way the code works is:

                    Output_PWM_Value = USB bytestream value *2 (this would be 255 maximum. 255 means full on.)

                    then there's a section that does this

                    if USB_button_bit = 1 then Output_PWM_Value =255


                    run set Output_PWM_Values to buffer

                    then every 42uS, an interrupt fires that compares a counter to the buffer value, and adjusts the state of all outputs accordingly


                    • #11
                      Here is what 2k1 posted, which is what my code is based on.
                      Digital Outputs
                      2 bytes per output
                      P = Value of PWM
                      ([7bit Value + 1]/128)% duty cycle
                      Details of full period to be determined later
                      S = 1bit state
                      0 = Off
                      1 = on
                      T = 6bits of Timer to shutoff --> [Evaluated Units in Seconds]
                      If 6'bTTTTTT is 0, then shut off immediately on disconnect
                      If 6'bTTTTTT is between 1 and 10 inclusive, then wait [6'bTTTTTT] seconds after disconnect
                      If 6'bTTTTTT is 11, then wait 30 seconds after disconnect
                      If 6'bTTTTTT is 12, then wait 60 seconds after disconnect
                      If 6'bTTTTTT is 13, then wait 90 seconds after disconnect
                      If 6'bTTTTTT is greater than 14, then wait ([6'bTTTTTT] * 10) seconds after disconnect
                      M = 2bit Output Mode
                      2'b00: Normal Full-Off or Full-On Operation Mode
                      2'b01: Pulse Width Modulation Operation Mode
                      2'b10: Yet to be determined
                      2'b11: Yet to be determined
                      The slider controls P (0-127, default is 127)
                      The button control S (on or off, default to off)

                      If the slider did everything, the button would be pointless. The only reason for the button is so you can leave the slider set on some value, and toggle the output from completely off to on for the PWM value.

                      Obviously the first byte doesn't work as originally documented, so how does it work? You tell me how it works, and I'll fix my code accordingly.


                      • #12
                        After a little more experimentation, here is what I find:

                        I tried using all 8 bits for PWM, and that didn't work right. The LED would get brighter and dimmer while slowly sliding the slider bar from one side to the other. When I just use the first 7 bits, it the LED brighness changes smoothly, as it should.

                        The 'S' bit in the above byte spec confuses me. When 0, it appears the slider determines the PWM of the port. When 1, the LED is just full on, without any PWM.

                        The 'MM' bits in the above spec also don't seem to do anything. It looks like the outputs are always in PWM mode, even if those bits are set to 00, meaning full on/off mode.


                        • #13
                          yup, that's right.

                          that's how i understood nick to want it via conversations with him.

                          when he gets back, we can tweak as neccessary.


                          • #14
                            New version of FBDemo released.


                            • #15
                              greenman, have you ever made any progress on the timers? I'd like to see the outputs shut off when data quits flowing to the FB.