AVR128DB PWM and UART1 on PORTC

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I routed PWM (split mode) to PORTC (WO on PC0..PC5) and also wanted to use the serial (PC0=TX1, PC1=RX1) on that port. The transmitter pin needs to be set as an output, but then PWM shows up... What... Is there something I can do to cause the UART to override the PWM?

 

It is one of those new parts (AVR128DB32)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Disable the pwm output on that pin via CMPnEN or its split mode equivalent name. They don't give much info on what takes place if multiple overrides are in use on the same pin, but I would guess each peripheral ends up using the same input to the override output, so probably becomes a contest of which one happens to be stronger when there is a disagreement. In any case its safe to say they both cannot be using the same pin at the same time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

If you do not enable the WO0 and WO1 PWM outputs, you can use the USART1 TXD and RXD.

 

// WO2-5(PC2-PC5) ENABLE
TCA0.SPLIT.CTRLB = TCA_SPLIT_LCMP2EN_bm | TCA_SPLIT_HCMP0EN_bm | TCA_SPLIT_HCMP1EN_bm | TCA_SPLIT_HCMP2EN_bm;

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That worked, thanks.

 

I was doing ridiculous things. The main lesson was that "Control B - Split Mode" is what I should have been looking at, not "Control B - Normal Mode."