• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » Ecan GPIO switching
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • Forums

    Ecan GPIO switching

    This question has suggested answer(s)
    David Marcus
    Posted by David Marcus
    on Apr 12 2012 13:38 PM
    Intellectual790 points

    I am having some issues when I am trying to switch the pins on the GPIO pins being used for CAN on the DSP.  When the program boots up it we default for Can A to be pins 18/19.  But when I give it the command to switch pins for Ecan it does not work.  I want to know if I am missing something in the process of switching the GPIO pins.  Any help would be greatly appreciated.  Let me know If you need to see more of the code but below is the section I use to select the GPIO pins.    

    CanAValue can be 0 or 1.

    void InitECanaGpio(Uint16 CanAValue)
    {

    EALLOW;

    switch (CanAValue){

    case 0:
    //default setting
    /* Enable internal pull-up for the selected CAN pins */
    // Pull-ups can be enabled or disabled by the user.
    // This will enable the pullups for the specified pins.
    // Comment out other unwanted lines.


    GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pull-up for GPIO18 (CANRXA)
    GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up for GPIO19 (CANTXA)

    /* Set qualification for selected CAN pins to asynch only */
    // Inputs are synchronized to SYSCLKOUT by default.
    // This will select asynch (no qualification) for the selected pins.

    GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3; // Asynch qual for GPIO18 (CANRXA)


    /* Configure eCAN-A pins using GPIO regs*/
    // This specifies which of the possible GPIO pins will be eCAN functional pins.

    GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 3; // Configure GPIO18 for CANRXA operation
    GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 3; // Configure GPIO19 for CANTXA operation
    GpioCtrlRegs.GPADIR.bit.GPIO19 = 1; //Configure CANTXA as output


    break;

    case 1:

    /* Enable internal pull-up for the selected CAN pins */
    // Pull-ups can be enabled or disabled by the user.
    // This will enable the pullups for the specified pins.
    // Comment out other unwanted lines.

    GpioCtrlRegs.GPAPUD.bit.GPIO30 = 0; // Enable pull-up for GPIO30 (CANRXA)
    GpioCtrlRegs.GPAPUD.bit.GPIO31 = 0; // Enable pull-up for GPIO31 (CANTXA)


    /* Set qualification for selected CAN pins to asynch only */
    // Inputs are synchronized to SYSCLKOUT by default.
    // This will select asynch (no qualification) for the selected pins.

    GpioCtrlRegs.GPAQSEL2.bit.GPIO30 = 3; // Asynch qual for GPIO30 (CANRXA)

    /* Configure eCAN-A pins using GPIO regs*/
    // This specifies which of the possible GPIO pins will be eCAN functional pins.

    GpioCtrlRegs.GPAMUX2.bit.GPIO30 = 1; // Configure GPIO30 for CANRXA operation
    GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 1; // Configure GPIO31 for CANTXA operation
    GpioCtrlRegs.GPADIR.bit.GPIO31 = 1; //Configure CANTXA as output


    break;
    }


    EDIS;
    }

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Trey German
      Posted by Trey German
      on Apr 12 2012 13:58 PM
      Suggested Answer
      Genius14510 points

      David,

      My guess would be that after you have setup the eCAN to work with one set of pins, you do not turn off those pins before switching to the other set.  I would recommend before changing the gpio mux to point to the eCAN, change the pins back to normal GPIOs.

      Let me know if that fixes it.

      Regards,

      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 12 2012 14:05 PM
      Intellectual790 points

      How should I go about doing that?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Trey German
      Posted by Trey German
      on Apr 12 2012 14:13 PM
      Suggested Answer
      Genius14510 points

      Replace this:

      case 0:
      //default setting
      /* Enable internal pull-up for the selected CAN pins */
      // Pull-ups can be enabled or disabled by the user.
      // This will enable the pullups for the specified pins.
      // Comment out other unwanted lines.


      GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pull-up for GPIO18 (CANRXA)
      GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up for GPIO19 (CANTXA)

      /* Set qualification for selected CAN pins to asynch only */
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3; // Asynch qual for GPIO18 (CANRXA)


      /* Configure eCAN-A pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 3; // Configure GPIO18 for CANRXA operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 3; // Configure GPIO19 for CANTXA operation
      GpioCtrlRegs.GPADIR.bit.GPIO19 = 1; //Configure CANTXA as output


      break;

      case 1:

      /* Enable internal pull-up for the selected CAN pins */
      // Pull-ups can be enabled or disabled by the user.
      // This will enable the pullups for the specified pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAPUD.bit.GPIO30 = 0; // Enable pull-up for GPIO30 (CANRXA)
      GpioCtrlRegs.GPAPUD.bit.GPIO31 = 0; // Enable pull-up for GPIO31 (CANTXA)


      /* Set qualification for selected CAN pins to asynch only */
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO30 = 3; // Asynch qual for GPIO30 (CANRXA)

      /* Configure eCAN-A pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX2.bit.GPIO30 = 1; // Configure GPIO30 for CANRXA operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 1; // Configure GPIO31 for CANTXA operation
      GpioCtrlRegs.GPADIR.bit.GPIO31 = 1; //Configure CANTXA as output


      break;

      With this:

      case 0:
      //default setting
      /* Enable internal pull-up for the selected CAN pins */
      // Pull-ups can be enabled or disabled by the user.
      // This will enable the pullups for the specified pins.
      // Comment out other unwanted lines.


      GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pull-up for GPIO18 (CANRXA)
      GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up for GPIO19 (CANTXA)

      /* Set qualification for selected CAN pins to asynch only */
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3; // Asynch qual for GPIO18 (CANRXA)


      /* Configure eCAN-A pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      // Turn off other CAN pins
       GpioCtrlRegs.GPAMUX2.bit.GPIO30 = 0; // Configure GPIO30 for GPIO operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 0; // Configure GPIO31 for GPIOoperation


      GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 3; // Configure GPIO18 for CANRXA operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 3; // Configure GPIO19 for CANTXA operation
      //GpioCtrlRegs.GPADIR.bit.GPIO19 = 1; //Configure CANTXA as output
      // Setting the direction of pins under peripheral control is un-neccessary


      break;

      case 1:

      /* Enable internal pull-up for the selected CAN pins */
      // Pull-ups can be enabled or disabled by the user.
      // This will enable the pullups for the specified pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAPUD.bit.GPIO30 = 0; // Enable pull-up for GPIO30 (CANRXA)
      GpioCtrlRegs.GPAPUD.bit.GPIO31 = 0; // Enable pull-up for GPIO31 (CANTXA)


      /* Set qualification for selected CAN pins to asynch only */
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO30 = 3; // Asynch qual for GPIO30 (CANRXA)

      /* Configure eCAN-A pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      // Turn off other CAN pins
       GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 0; // Configure GPIO18 for GPIO operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0; // Configure GPIO19 for GPIO operation


      GpioCtrlRegs.GPAMUX2.bit.GPIO30 = 1; // Configure GPIO30 for CANRXA operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 1; // Configure GPIO31 for CANTXA operation
      //GpioCtrlRegs.GPADIR.bit.GPIO31 = 1; //Configure CANTXA as output


      break;

      Regards,
      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Frank Bormann
      Posted by Frank Bormann
      on Apr 13 2012 01:23 AM
      Genius5225 points

      I think both of you forgot that the GPxMUX - registers are EALLOW - protected.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 13 2012 07:35 AM
      Intellectual790 points

      I thought Eallow allowed you access and edis closed the access.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Trey German
      Posted by Trey German
      on Apr 13 2012 08:16 AM
      Genius14510 points

      That is correct.  If you called EALLOW before this code without calling EDIS, you should be ok.  In practice though, you should always call EALLOW right before you are accessing a protected register and call EDIS right afterward.  This is to protect your system in the case the processor "goes into the weeds" so to speak.  Imagine if your device was driving some power electronics connected to 3 phase mains and the GPIOs controlling the gate drive got messed up....

      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 17 2012 08:32 AM
      Intellectual790 points

      The GPIO ports are still not switching correctly.  

      I have another function for can B which will be show below which is pretty much identical to Can A but with different GPIO.  When Can B is switched from 16/17 to 08/10.  The pin on GPIO 8 drops low but the data is still comming out 16.

      This is what happens on GPIO 08

      This is what happens on GPIO 16(correct but wrong pin)

      void InitECanbGpio(Uint16 CanBValue)
      {
      EALLOW;
      switch (CanBValue){

      case 0:



      //default
      GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; // Enable pull-up for GPIO16 (CANTXB)
      GpioCtrlRegs.GPAPUD.bit.GPIO17 = 0; // Enable pull-up for GPIO17 (CANRXB)

      // Set qualification for selected CAN pins to asynch only
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO17 = 3; // Asynch qual for GPIO17 (CANRXB)

      // Turn off other CAN pins
      GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0; // Configure GPIO08 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0; // Configure GPIO10 for CANRXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0; // Configure GPIO12 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0; // Configure GPIO13 for CANRXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0; // Configure GPIO20 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0; // Configure GPIO21 for CANRXB operation

      // Configure eCAN-B pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 2; // Configure GPIO16 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 2; // Configure GPIO17 for CANRXB operation
      //GpioCtrlRegs.GPADIR.bit.GPIO16 = 1; //Configure CANTXB as output


      break;

      case 1:

      GpioCtrlRegs.GPAPUD.bit.GPIO8 = 0; // Enable pull-up for GPIO08 (CANTXB)
      GpioCtrlRegs.GPAPUD.bit.GPIO10 = 0; // Enable pull-up for GPIO10 (CANRXB)

      // Set qualification for selected CAN pins to asynch only
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAQSEL1.bit.GPIO10 = 3; // Asynch qual for GPIO10 (CANRXB)

      // Turn off other CAN pins
      GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0; // Configure GPIO16 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0; // Configure GPIO17 for CANRXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0; // Configure GPIO12 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0; // Configure GPIO13 for CANRXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0; // Configure GPIO20 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0; // Configure GPIO21 for CANRXB operation

      // Configure eCAN-B pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 2; // Configure GPIO08 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 2; // Configure GPIO10 for CANRXB operation
      //GpioCtrlRegs.GPADIR.bit.GPIO8 = 1; //Configure CANTXB as output


      break;

      case 2:

      GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0; // Enable pull-up for GPIO12 (CANTXB)
      GpioCtrlRegs.GPAPUD.bit.GPIO13 = 0; // Enable pull-up for GPIO13 (CANRXB)

      // Set qualification for selected CAN pins to asynch only
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAQSEL1.bit.GPIO13 = 3; // Asynch qual for GPIO13 (CANRXB)

      // Turn off other CAN pins
      GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0; // Configure GPIO16 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0; // Configure GPIO17 for CANRXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0; // Configure GPIO08 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0; // Configure GPIO10 for CANRXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0; // Configure GPIO20 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0; // Configure GPIO21 for CANRXB operation

      // Configure eCAN-B pins using GPIO regs
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 2; // Configure GPIO12 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 2; // Configure GPIO13 for CANRXB operation
      //GpioCtrlRegs.GPADIR.bit.GPIO12 = 1; //Configure CANTXB as output



      break;


      case 3:

      GpioCtrlRegs.GPAPUD.bit.GPIO20 = 0; // Enable pull-up for GPIO20 (CANTXB)
      GpioCtrlRegs.GPAPUD.bit.GPIO21 = 0; // Enable pull-up for GPIO21 (CANRXB)

      // Set qualification for selected CAN pins to asynch only
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO21 = 3; // Asynch qual for GPIO21 (CANRXB)

      // Turn off other CAN pins
      GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0; // Configure GPIO16 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0; // Configure GPIO17 for CANRXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0; // Configure GPIO08 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0; // Configure GPIO10 for CANRXB operatio
      GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0; // Configure GPIO12 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0; // Configure GPIO13 for CANRXB operationn

      // Configure eCAN-B pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 2; // Configure GPIO20 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 2; // Configure GPIO21 for CANRXB operation
      //GpioCtrlRegs.GPADIR.bit.GPIO20 = 1; //Configure CANTXB as output


      break;
      }



      EDIS;
      }
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Trey German
      Posted by Trey German
      on Apr 17 2012 09:06 AM
      Suggested Answer
      Genius14510 points

      David,

      The above code looks good, but I have to wonder how the CAN peripheral is interpretting this GPIO switch.  When we switch the GPIO mux, we have no idea what state the internal nets are that connect to the CAN controller.  I think we should also take the CAN controller off the bus before we change the GPIOs associated with the CAN peripheral.  Try setting the CCR bit before you change the GPIO mux configuration, and then clear the bit after you have the GPIO mux how you want it.

      Let me know how this works for you.

      Regards,

      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 17 2012 09:53 AM
      Intellectual790 points

      The CCR is set  then unset in the CAnshadow function.  Could the error we occuring in the function nused to transmit the command :

      [TX] - TMS CANB-SEND;ID=00h;Data=012345h<CR><LF>

      	else if(strcmp(mode,"-SEND")==0){
      InitECanbGpio(CanB_Value);
      ptr = strtok (0,";");
      ptr += 3;
      for(i=0;i<4;i++)
      ph[i] = *ptr++;
      c = sscanf(ph,"%x",&ID); //write address

      ptr = strtok (0,";");
      ptr += 5;
      i = 0;
      ph[2] = 0;
      while(c != 0){
      ph[0] = *ptr++;
      ph[1] = *ptr++;
      c = sscanf(ph,"%x",&Data[i]); //write address
      ++i;
      }
      data_length = i-1;
      //set message ID
      ECanbMboxes.MBOX0.MSGID.all = 0;
      ECanbMboxes.MBOX0.MSGID.bit.STDMSGID = ID;
      //configure Mailbox0 as transmit
      ECanbShadow.CANMD.all = ECanbRegs.CANMD.all;
      ECanbShadow.CANMD.bit.MD0 = 0;
      ECanbRegs.CANMD.all = ECanbShadow.CANMD.all;
      // Enable Mailbox0
      ECanbShadow.CANME.all = ECanbRegs.CANME.all;
      ECanbShadow.CANME.bit.ME0 = 1;
      ECanbRegs.CANME.all = ECanbShadow.CANME.all;

      if(data_length<=8){
      ECanbMboxes.MBOX0.MSGCTRL.bit.DLC = data_length;
      }
      else{
      SciaTx(String_err);
      SciaTx(": Too many Bytes");
      return;
      }

      ECanbMboxes.MBOX0.MDH.all = 0;
      ECanbMboxes.MBOX0.MDL.all = 0;
      switch (data_length){
      case 8:
      ECanbMboxes.MBOX0.MDH.byte.BYTE7 = Data[7];
      case 7:
      ECanbMboxes.MBOX0.MDH.byte.BYTE6 = Data[6];
      case 6:
      ECanbMboxes.MBOX0.MDH.byte.BYTE5 = Data[5];
      case 5:
      ECanbMboxes.MBOX0.MDH.byte.BYTE4 = Data[4];
      case 4:
      ECanbMboxes.MBOX0.MDL.byte.BYTE3 = Data[3];
      case 3:
      ECanbMboxes.MBOX0.MDL.byte.BYTE2 = Data[2];
      case 2:
      ECanbMboxes.MBOX0.MDL.byte.BYTE1 = Data[1];
      case 1:
      ECanbMboxes.MBOX0.MDL.byte.BYTE0 = Data[0];
      }

      ECanbShadow.CANTRS.all = 0;
      ECanbShadow.CANTRS.bit.TRS0 = 1; // Set TRS for mailbox 0
      ECanbRegs.CANTRS.all = ECanbShadow.CANTRS.all;
      Msg_Flags.bit.Timeout = 0;
      CpuTimer0Regs.TCR.bit.TSS = 0; //start Timer0 to catch runaway while loop
      do{
      ECanbShadow.CANTA.all = ECanbRegs.CANTA.all;
      if(Msg_Flags.bit.Timeout == 1){
      SciaTx(String_err);
      SciaTx(": Timeout");
      return;
      }
      } while(ECanbShadow.CANTA.bit.TA0 == 0 ); // Wait for TA5 bit to be set..
      CpuTimer0Regs.TCR.bit.TSS = 0; //stop Timer0 since while successful
      CpuTimer0Regs.TCR.bit.TRB = 1; //reload Timer0
      ECanbShadow.CANTA.all = 0;
      ECanbShadow.CANTA.bit.TA0 = 1; // Clear TA5
      ECanbRegs.CANTA.all = ECanbShadow.CANTA.all;

      //set ID in response message
      String_CAN_ID[7]=command[17];
      String_CAN_ID[8]=command[18];
      //send ID Response
      SciaTx(String_CAN_ID);
      SciaTx(String_crlf);
      SciaTxByte(data_length);

      }

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Trey German
      Posted by Trey German
      on Apr 17 2012 10:17 AM
      Genius14510 points

      David,

      You should only need to set the CCR bit when you are changing the bit rate or when you want to go bus off.  I don't see in the above code that you posted where CCR is set.  Give my suggestion a shot and let me know if it works.


      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 20 2012 08:37 AM
      Intellectual790 points

      This didn't work either.  I really am stuck.  Even though the line appears to swtich, nothing comes out on the new line.  it only comes out on the old line we are trying to switch from

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Trey German
      Posted by Trey German
      on Apr 20 2012 08:41 AM
      Genius14510 points

      David,

      That is really wierd.  We must be missing something.

      Can you check that the writes to the MUX registers are actually writing?  Once you set the bits to 0 you shouldn't see anything come out of the old pin.

      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 20 2012 08:46 AM
      Intellectual790 points

      you can see right here i close all the mux ports first.  And the when the line is activated the line drops low.

      switch (CanBValue){

      case 0:
      // Turn off other CAN pins
      GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0; // Configure GPIO08 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0; // Configure GPIO10 for CANRXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0; // Configure GPIO12 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0; // Configure GPIO13 for CANRXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0; // Configure GPIO20 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0; // Configure GPIO21 for CANRXB operation

      //default
      GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; // Enable pull-up for GPIO16 (CANTXB)
      GpioCtrlRegs.GPAPUD.bit.GPIO17 = 0; // Enable pull-up for GPIO17 (CANRXB)

      // Set qualification for selected CAN pins to asynch only
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO17 = 3; // Asynch qual for GPIO17 (CANRXB)


      // Configure eCAN-B pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 2; // Configure GPIO16 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 2; // Configure GPIO17 for CANRXB operation
      //GpioCtrlRegs.GPADIR.bit.GPIO16 = 1; //Configure CANTXB as output


      break;

      case 1:

      // Turn off other CAN pins
      GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0; // Configure GPIO16 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0; // Configure GPIO17 for CANRXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0; // Configure GPIO12 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0; // Configure GPIO13 for CANRXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0; // Configure GPIO20 for CANTXB operation
      GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0; // Configure GPIO21 for CANRXB operation

      GpioCtrlRegs.GPAPUD.bit.GPIO8 = 0; // Enable pull-up for GPIO08 (CANTXB)
      GpioCtrlRegs.GPAPUD.bit.GPIO10 = 0; // Enable pull-up for GPIO10 (CANRXB)

      // Set qualification for selected CAN pins to asynch only
      // Inputs are synchronized to SYSCLKOUT by default.
      // This will select asynch (no qualification) for the selected pins.
      // Comment out other unwanted lines.

      GpioCtrlRegs.GPAQSEL1.bit.GPIO10 = 3; // Asynch qual for GPIO10 (CANRXB)


      // Configure eCAN-B pins using GPIO regs*/
      // This specifies which of the possible GPIO pins will be eCAN functional pins.

      GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 2; // Configure GPIO08 for CANTXB operation
      GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 2; // Configure GPIO10 for CANRXB operation
      //GpioCtrlRegs.GPADIR.bit.GPIO8 = 1; //Configure CANTXB as output


      break;

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Trey German
      Posted by Trey German
      on Apr 20 2012 09:00 AM
      Genius14510 points

      I know in your code you close them, but there could be something else at play here.  Please check in the memory  or registers window that the bits are being set as programmed in your code.  There is no reason the old pins should still spit out data after they have been turned off.

      Trey

      Trey German

      C2000 Applications

      If a post answers your question, please mark it with the "verify answer" button.
      Visit these helpful C2000 Links!
      C2000 TI Wiki Pages
      TI Forum Sitemap
      ControlSUITE
      C2000 Getting Started
      CLA FAQs
      Workshop Material!
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • David Marcus
      Posted by David Marcus
      on Apr 23 2012 14:31 PM
      Intellectual790 points

      After using the watch window I could see the bits switching but the program still doesn't work.  What is the next thing to check.

      bit {...} bit {...} bit {...}
      GPIO0 0 GPIO0 0 GPIO0 0
      GPIO1 0 GPIO1 0 GPIO1 0
      GPIO2 0 GPIO2 0 GPIO2 0
      GPIO3 0 GPIO3 0 GPIO3 0
      GPIO4 0 GPIO4 0 GPIO4 0
      GPIO5 0 GPIO5 0 GPIO5 0
      GPIO6 0 GPIO6 0 GPIO6 0
      GPIO7 0 GPIO7 0 GPIO7 0
      GPIO8 0 GPIO8 10 GPIO8 0
      GPIO9 0 GPIO9 0 GPIO9 0
      GPIO10 0 GPIO10 10 GPIO10 0
      GPIO11 0 GPIO11 0 GPIO11 0
      GPIO12 0 GPIO12 0 GPIO12 0
      GPIO13 0 GPIO13 0 GPIO13 0
      GPIO14 0 GPIO14 0 GPIO14 0
      GPIO15 0 GPIO15 0 GPIO15 0
      GPAMUX2 {...} GPAMUX2 {...} GPAMUX2 {...}
      all 4278190080 all 83886080 all 83886090
      bit {...} bit {...} bit {...}
      GPIO16 0 GPIO16 0 GPIO16 10
      GPIO17 0 GPIO17 0 GPIO17 10
      GPIO18 0 GPIO18 0 GPIO18 0
      GPIO19 0 GPIO19 0 GPIO19 0
      GPIO20 0 GPIO20 0 GPIO20 0
      GPIO21 0 GPIO21 0 GPIO21 0
      GPIO22 0 GPIO22 0 GPIO22 0
      GPIO23 0 GPIO23 0 GPIO23 0
      GPIO24 0 GPIO24 0 GPIO24 0
      GPIO25 0 GPIO25 0 GPIO25 0
      GPIO26 0 GPIO26 0 GPIO26 0
      GPIO27 0 GPIO27 0 GPIO27 0
      GPIO28 11 GPIO28 1 GPIO28 1
      GPIO29 11 GPIO29 1 GPIO29 1
      GPIO30 11 GPIO30 0 GPIO30 0
      GPIO31 11 GPIO31 0 GPIO31 0

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    12
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use