Arduino and PWM Board Not Interacting Properly

OK scratch that, it only worked because we had switched our PWM to the left instead of right slot controlled by the Arduino.

Apparently there is a bug in the Tlc5940 code where you can only use the LEFT slot for the PWM board. I found these things in the code (found in \evolver-arduino\libraries\Tlc5490_SAMD)

I found this code in the tlc5940.h file:

//PWM Board position defines

#define left_PWM 1

#define right_PWM 2

But these variables don’t seem to be called anywhere else in that file. I’m probably missing how that’s output into another file though.

Later in that same file:

//(RIGHT_PWM DEFINES)
PORT_PMUX_PMUXE_E; REG_TCC1_CC1 = 1; while (TCC1->SYNCBUSY.bit.CC1)  //These are a problem

There’s an annotation saying These are a problem. This is only true for the right PWM, the left one works fine.

Also, from tlc5940.cpp:

/* PWM positions:

   1 -> PWM in left slot

   2 -> PWM in right slot

   3 -> PWM in both slots

*/

void Tlc5940::init(uint8_t pwm_val, uint16_t initialValue)

{

  // set global PWM position values

  pos_1 = pwm_val & 0x1;

pos_2 = pwm_val & 0x2;

There isn’t a value set anywhere for both PWM = 3, leading me to believe that having two PWMs plugged in at one time was never implemented.

Our solution is to only use the left arduino controlled slot for the PWM, which works fine for our purposes. The right one can be the ADC board.