This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

using tiva C series in energia to control stepper motor

Other Parts Discussed in Thread: ENERGIA

Hello everyone

I wrote the following code to run a stepper motor in arduino depending upon a UART signal. The UART signal came from processing 2 code. Now instead of an arduino board i  want to run the same code on my TIVA C series tm4c123gh6m launch pad what should i  do.

 

Note- I used digital pins 8,9,10,11 of the arduino to run the motor. What does 8,9,10,11 refer to in tiva C series?

         

 

 
 
int a=8;
int b=9;
int c=10;
int d=11;
 
void setup()
{
  
  Serial.begin(9600);
 pinMode(a, OUTPUT);
 pinMode(b, OUTPUT);
 pinMode(c, OUTPUT);
 pinMode(d, OUTPUT);
establishContact(); 
}
 
void loop()
{
  int tex;
  tex=Serial.read();
  if(tex=='A')
  {
   digitalWrite(a,LOW);
   digitalWrite(b,HIGH);
   digitalWrite(c,LOW);
   digitalWrite(d,HIGH);
 
   delay(5);
 
   digitalWrite(a,LOW);
   digitalWrite(b,HIGH);
   digitalWrite(c,HIGH);
   digitalWrite(d,LOW);
 
   delay(5); 
 
   digitalWrite(a,HIGH);
   digitalWrite(b,LOW);
   digitalWrite(c,HIGH);
   digitalWrite(d,LOW);
 
   delay(5); 
 
   digitalWrite(a,HIGH);
   digitalWrite(b,LOW);
   digitalWrite(c,LOW);
   digitalWrite(d,HIGH);
 
   delay(5);
  }
}
 
void establishContact() {
  while (Serial.available() <= 0) {
    Serial.write('A');   // send a capital A
    delay(300);
  }
}
 
  • Gourav Zutshi said:
    What does 8,9,10,11 refer to in tiva C series?

    Nature of this question suggests that you have (some) reading/study ahead.

    After too many moons to count in MCU/related industry - we've rarely (never) encountered "8,9,10,11" as definitive MCU identifiers - unless employed as MCU pin numbers.  Even then - the pin number has very little bearing upon MCU set-up/configuration - it is the MCU's, "Pin Functionality" particularly its "Port Residence" which is far more critical.  (In fact - about the only time MCU pin number comes into play - is during pcb design and circuit/trace routing.)

    Know that no MCU (even famed Arduino) is likely to be able to, "directly drive" any but the tiniest of stepper motors.  Instead - it's always safer and preferable to impose an appropriate buffer/driver IC between the MCU and motor.  (applies for non-stepper motors - as well)

    MCUs from this vendor enable most any pin to serve as a GPIO (requires your study, perhaps) configured as Output - to be routed/connected to the stepper driver IC.  Via simple fate it may be that TM4C MCU pins numbered 8-11 may serve as GPIO.  Review of the MCU manual reveals.

    Code you provide should be fairly easy for you to convert/massage into Tiva Peripheral Driver library format - provided you devote time/effort to read the wealth of material available here.

  • There is not enough documentation on energia

  • Gourav Zutshi said:

    There is not enough documentation on energia

    Should that quote have resulted after your read of my writing...(may need to find stronger/closer wall to bang my head...)

  • no that was before i read your answer, i apologize for my lack of knowledge in this matter.

  • Mon ami - no apology sought/indicated - appreciate your clarification.

    If you can run your stepper motor to your satisfaction w/Arduino - know that MCUs here are far more capable - but that extra performance potential thru ARM requires a significant effort (by you) of time & effort.  For a single (one-off) project - this may be unworthy of the effort. 

    If instead - you wish to gain general & broader MCU understanding - then the wealth of labs, videos, MCU manual, Peripheral Library Drivers Guide and numerous code examples - all found here/nearby - serve well to guide your footsteps.  But - if you're like most here - this is beyond a few days - or even few weeks - of your time/effort/focus...

    And - your study of "C" will be expected - even required.  (unless you can exist using "entirely" unmodified, sample code.)

    Arduino exists for good reason - connects many dots - buffers (shields) the new or casual user from, "gory tech detail."  Such shielding is rare (if ever) present w/ARM...

  • cb1 I suggest you study Energia.  it is forked from Arduino IDE and does exactly all of what you just said about Arduino but does it for the MSP430 and Tiva C (and other) LaunchPads. 

    When you are done with Energia and ready to move a step closer to traditional build environments Code Composer 6 has an import energia project capability.  (CB1, I know its not Keil/IAR yet its a pathway in the "right" direction).

     

    The pin mapping http://energia.nu/guide/pinmapping/

  • @Dexter,

    Thanks for that - as you gleaned - our knowledge of Energia resulted from past/brief review - was not to our interest nor liking.  Further - along w/multi-seat, paid IAR - clients demand that we choose devices from the broad ARM spectrum - not limited to single (or few) vendors.  (in the past - iirc - Energia did not support the "wide spectrum" of ARM...)

    As return of your suggestion - might I steer you/your group to (relatively) new Cortex M0.  That part - along w/M3 - "both (effectively) banned here" but very nicely invades space/price of MSP and of course is available from multi-sources - and in volume drops below 1 (USD).

    As you gain more time here you may learn that our small, tech group often choose not to be first, "adopters" of most anything tech that proves, "too new."   (i.e. we still use Stellaris library - tried/tested/proven - and escapes the many pitfalls which befell rebrand ware.)  Along similar lines - while you list Tiva as being supported by Energia - and direct our group there - it appears that a large number of Energia-Tiva users, "wash-up" these rocky (Tiva forum) shores...

    Thus might it be that Energia-Tiva is not as full/complete/tried-true as you wish/hope?...  (we've no interest in MSP as multi-sourced M0 proves superior {our applications})

  • Yes, Energia is still limited to TI devices.  The creator/founder started it as a fun project on the side while working at TI.  it has grown a lot from there. it is open so I believe the community could in theory drive it wherever. 

     

    So in short: the advantage is a simple interface for the beginner with a cleaner pathway to more traditional tools (as opposed to Arduino), the cost is narrowing the scope to TI MCUs.  Each can make their own analysis of that tradeoff.

     

    Regarding your suggestion, already on that path.

    Given my personal work history (4 years a senior member of the Tiva/Stellaris Apps team) I have an affinity for TI parts when I can.  Tools less so, but still familiarity can lead to efficiency in my case.  Regardless having recently switched back the silicon consumer side we will be branching out more and more in the very near future.  Much like you, the best choice for our client is the best choice for us.  To be good stewards of our client projects we must look beyond corporate borders.  I have my sights on a couple of part families to add to the stable very soon, at least one includes the M0 class.  Also investing in paid seats for one of the major tool chains (undetermined if it will be Keil or IAR first).  Having said all that, all other things being equal (at least as much as they can be) if a TI part fits the bill it will be my first choice for a variety of reasons. 

     

    Dexter

  • D'uh - just dawns - are you the (past), "Stellaris Dexter?"  (how could I have missed that?)

    If so - kindly accept our thanks/gratitude for the assistance you often provided many here!  (to include our group)

  • I am one and the same.

    Your thanks/gratitude accepted with humility.  Just a part of the job.  As you see I want to continue to help folks where I can.  Although now I must admit I have hopes that should they require additional engineering service beyond what this forum can offer they may know where to find me. :).  My motives thus not completely altruistic.

  • INTEGRIS Dexter said:
    Just a part of the job.

    Such may be true if past, "job description" included, "So often going above/beyond - providing key insights into "how/why" (so rare - yet so helpful) and finding & (often) repairing broken links or otherwise, "disappearing, critical data.""

    And - you were always kind in supporting, "devil in the detail" assertion of one here...  (I've migrated that (endless) request into a stylized "forum template" which sits (adhesively, above) in "dry dock" while sea lanes beckon...

    Good luck w/your new launch and user's here should know that our small tech group bestows highest recommendation/confidence upon, "Dexter!"  (independent of leading prefix...{Stellaris/Integris})