Jump to content

analogWrite and PWMWrite does not work on TivaC TM4C123

Recommended Posts



I am using the latest energia release 0101E0017 and suddenly analogWrite and PWMWrite does not work on my TivaC Board, with TM4C123

#define EN_A PF_0
#define EN_B PF_1

#define IN1 PE_0
#define IN2 PE_1
#define IN3 PE_3
#define IN4 PE_2

#include <wiring_analog.c>

void setup() {
  pinMode(EN_A, OUTPUT);
  pinMode(EN_B, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);   

void loop()
  PWMWrite(EN_B, 256, 16, 1000);

I tried few different ports as well. When the PWMWrite or analogWrite statement is run, the pin will just go high. I have tested with a scope that PWM signal is not generated.


Now the interesting thing - I fired the following code on the same setup, this time using Servo.h - connected to RED_LED and It works.

#include <Servo.h> 
Servo myservo;  

void setup() 
void loop() 

What do I need to do in order to get PWM working with this TivaC board?


Best regards,


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...