chipKIT® Development Platform

Inspired by Arduino™

Can not used analogWrite() on DP32.

Created Sat, 05 Oct 2013 06:43:14 +0000 by o_pas


o_pas

Sat, 05 Oct 2013 06:43:14 +0000

My configuration was.

  1. chipkit_Bootloader_DP32.hex 14,839 30/05/2013
  2. mpide-0023-windows-20130715

In reference manual said PWM ouput for digitalWrite() at pin 8,2,3,13,6 When i tried my sket like this

void loop()  { 
  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    analogWrite(2, fadeValue);                 
    analogWrite(3, fadeValue);
    analogWrite(6, fadeValue);
    analogWrite(8, fadeValue);    
    analogWrite(13, fadeValue);    
    // wait for 30 milliseconds to see the dimming effect    
    delay(30);                            
  } 
}

No LED fading on that pin. It only blinking (ON-OFF). I think have a problem in MPIDE library.

PS. sorry for my English.


majenko

Sat, 05 Oct 2013 11:03:35 +0000

With that sketch I see fading on all pins except pin 8. On that pin I see a very brief flash of HIGH, but mainly LOW.

Something may be amiss in the configuring of the OC1 channel.


o_pas

Sat, 05 Oct 2013 16:36:52 +0000

With that sketch I see fading on all pins except pin 8. On that pin I see a very brief flash of HIGH, but mainly LOW. Something may be amiss in the configuring of the OC1 channel.

Now i downloaded MPIDE latest version (mpide-0023-windows-20130918-test) and run my sketch everything same as majenko said.

Wait for new MPIDE to fix this problem.


caroper

Sun, 06 Oct 2013 18:55:10 +0000

KeithV from Digilent located it and submitted the fix for the later release. you can see this thread for the full details:

http://www.chipkit.org/forum/viewtopic.php?f=7&t=2467

Cheers Chris


o_pas

Tue, 15 Oct 2013 16:02:26 +0000

Now i can fix problem in DigitalWrite() in DP32. In mpide-0023-windows-20130715

  1. In Boards_Data.c in the variant directory change: const uint8_t digital_pin_to_timer_PGM[] = {

    to:

    const uint16_t digital_pin_to_timer_PGM[] = { Credit KeithV.

  2. In Boards_Data.c in the variant directory change: const uint8_t output_compare_to_digital_pin_PGM[] = { PIN_OC1, // A0, B3, B4, B15, B7 ; B15 RPB15R = 5

    to:

    const uint8_t output_compare_to_digital_pin_PGM[] = { [color=#FF0000] 0, // add this line [/color] PIN_OC1, // A0, B3, B4, B15, B7 ; B15 RPB15R = 5