infineon4engi@twitter infineon4engineers infineon@linkedin infineon@youtube
twitter Facebook Linkedin Youtube

Banner_DigitalMotorController Banner_IMM100_Series Banner_IMC100Series Banner_IRMCSeries Banner_iMotionApplicationKit


+ Reply to Thread
Results 1 to 8 of 8

Thread: Imc102t-f064: Uart1 -> rs232 / rs485

  1. #1
    arnaud is on a distinguished road
    Join Date
    Aug 2020
    Posts
    17
    Points
    130

    Imc102t-f064: Uart1 -> rs232 / rs485

    Hello

    About the user Mode UART allowing to drive the motor speed via the UART port.

    (I asked through another post how configure the Node address...)

    On the Reference Manual (v1.3 2020-4-26) §2.3.8 to connect multiple nodes to the same network, this is ok for me, I understand.

    Now, into my application, tha master will be distant, the we could use RS232 transciver to convert TTL<-> +12/-12V signal.
    The scheme on §2.3.8 remain ok.

    The communication is like the Modbus, then the Half duplex is Ok.
    Then, now, the master for us is RS485.
    So we must always listen data on Rx Way, then "get" the line when we want respond (Tx way)

    To do that, the device need a signal of type "RTS/CTS":
    i.e: Logical 0 to listen the line, then when we want send a response, then get the line by set signal to logical level 1.

    Is this type of output is automaticcaly managed by the IMC102?
    Or must use the script to customize the UART and the manage the RTS/CTS line?

    Thank

  2. #2
    Intermediate Intermediate
    Infineon Employee
    Infineon Employee
    daanish is on a distinguished road
    Join Date
    Nov 2019
    Posts
    17
    Points
    360
    IMC102T does not have built-in flow control using RTS/CTS. I don't have past experience with this type of flow control, but perhaps it can be implemented in Script using GPIO pins for RTS and CTS, and Configurable UART driver methods (see 2.6.11.3).
    Last edited by daanish; Sep 9th, 2020 at 03:43 PM. Reason: grammar
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    arnaud is on a distinguished road
    Join Date
    Aug 2020
    Posts
    17
    Points
    130
    Hello

    I think use script to mange this could be a good solution.

    Unfortunately, the CPU load seems to be high only with PFC and MCE activated.. (about70%)

    Then I already make a small Brake resistor control (to control a resistance to decrease DCBus when motor is in regeneration phase)
    and a very small algortihm to make cycle from 0 to 2400rpm, CPU load is already about 90..95%...

    So I think I must use an external processor to be compliant with the wanted external modbus into RS485.

    What is you advice concerning the CPU load?

    Bellow the script code:

    Code:
    #SET SCRIPT_USER_VERSION (1.00)
    
    /**************************************************************/
    /*Script execution time for Task0 in ms, maximum value 65535                                 */
    /**************************************************************/
    #SET SCRIPT_TASK0_EXECUTION_PERIOD (5)
    /* Defines number of lines to be executed every 1ms in Task0 */
    #SET SCRIPT_TASK0_EXECUTION_STEP (10)
    
    /**************************************************************/
    /*Script execution time for Task1 in 10ms, maximum value 65535                     */
    /**************************************************************/
    #SET SCRIPT_TASK1_EXECUTION_PERIOD (10)
    /*Defines number of lines to be executed every 10ms in Task1*/
    #SET SCRIPT_TASK1_EXECUTION_STEP (20)
    
    
    /**************************************************************/
    /* constant definition                                                                                             */
    /**************************************************************/
    CONST int VDCBus_RBrakeLevelOn = 3402;    /* 4095 = 499.42V, ratio = 0.12195. 415V = #3402 */
    CONST int VDCBus_RBrakeLevelOff = 3361;   /* 4095 = 499.42V, ratio = 0.12195. 420V = #3361 */
    
    CONST int VDCBus_RBrakePeriodMs = 5500;   /* = Ton / Period = 5500ms / 293ms */
    CONST int VDCBus_RBrakeIncStep = 190;     /* = Ton / Period = 5500ms / 293ms */
    
    /* RBrake FSM State constant */
    CONST int VDCBUS_RBRAKE_STATE_OFF = 0;
    CONST int VDCBUS_RBRAKE_STATE_ON = 1;
    
    /* Movement FSM state constant */
    CONST int FSM_STOP = 0;
    CONST int FSM_ON = 1;
    CONST int FSM_DECELERATING = 2;
    
    
    
    /**************************************************************/
    /* Global variable definition                                                                                    */
    /**************************************************************/
    int Modbus_Command;
    int VDCBus_RBrakeState;
    int   FSM_State;
    
    int Temp1;
    int Temp2;
    int Temp3;
    
    /**************************************************************/
    /* Task0 init function                                                                                             */
    /**************************************************************/
    Script_Task0_init()
    {
      /*Initialize global variable*/
      VDCBus_RBrakeState = VDCBUS_RBRAKE_STATE_OFF;
    
      /* local variable definition */
    
      /*Initialize local variable*/
    
      /* Initialize RBRake Output command */
      GPIO21_OUT = 0;
    }
    
    /**************************************************************/
    /* Task0 script function                                                                          */
    /**************************************************************/
    Script_Task0()
    {
    
      /*********************** RBrake FSM ****************************/
      if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_OFF)
      {
        /* Test if DCBus over pass limit */
        if (VdcFilt > VDCBus_RBrakeLevelOn)
        {
          GPIO21_OUT = 1;
          VDCBus_RBrakeState = VDCBUS_RBRAKE_STATE_ON;
        }
      } /* End if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_OFF)  */
    
      if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_ON)
      {
        if (VdcFilt < VDCBus_RBrakeLevelOff)
        {
          /* VDCBus is OK */
          GPIO21_OUT = 0;
          VDCBus_RBrakeState = VDCBUS_RBRAKE_STATE_OFF;
        }
      } /* End if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_ON) */
    }
    
    
    
    /**************************************************************/
    /* Task1 init function                                                                                             */
    /**************************************************************/
    Script_Task1_init()
    {
      /*Initialize global variable*/
      Modbus_Command = 0;
      FSM_State = FSM_STOP;
    
      /* local variable definition */
      int TargetVelocity;
    
      /*Initialize local variable*/
      int LocalCommand;
    
      LocalCommand = 0;
      AngleSelect = 2;  /* use rotor Flux Angle */
      CtrlModeSelect = 2; /*Speed control mode */
    
    }
    
    /**************************************************************/
    /* Task1 script function                                                                          */
    /* Ratio Speed 2730tr/min => #16384 => Ratio x 6                                  */
    /**************************************************************/
    Script_Task1()
    {
      Temp1 = abs_MotorSpeed;
      if (FSM_State == FSM_STOP)
      {
        /* Wait Modbus_Command On Off = On */
    
        if (Modbus_Command & 0x0200)  /* Motor On/Off */
        {
          /*Clear eventual PFC fault and start it */
          PFC_FaultClear = 1;
          PFC_Command = 1;
    
          FSM_State = FSM_ON;
    
          /* x10 because given in 10tr/min. x6 Tr/min -> Internal; */
          TargetSpeed = (Modbus_Command & 0x01FF) * 60;
    
          if   (Modbus_Command & 0x0400)
          {
            TargetSpeed = -TargetSpeed;
          }
    
          Command = 1;  /* Start the motor */
        }
      }
    
      if (FSM_State == FSM_ON)
      {
        /* Wait Modbus_Command On Off = Off */
        if ((Modbus_Command & 0x0200) == 0)
        {
          TargetSpeed = 0;
          FSM_State = FSM_DECELERATING;
        }
      }
    
      if (FSM_State == FSM_DECELERATING)
      {
        if (abs_MotorSpeed < (200 * 6))
        {
          /* Motor velocity is low, stop motor */
          Command = 0;
          FSM_State = FSM_STOP;
        }
      }
    }

  4. #4
    arnaud is on a distinguished road
    Join Date
    Aug 2020
    Posts
    17
    Points
    130
    Hello

    I think I could also done by script, but, I already make some little management into the script and the CPU load is already over 95%!

    Then i will use a small processor to make the modbus RS485 conversion.

    What is your advice according the CPU load? (I can see CPU Load is already to 70% with Motor and PFC activated)
    My script leading to 95% of CPU Load, I do not think it is too much!
    Code:
    #SET SCRIPT_USER_VERSION (1.00)
    
    /**************************************************************/
    /*Script execution time for Task0 in ms, maximum value 65535                                 */
    /**************************************************************/
    #SET SCRIPT_TASK0_EXECUTION_PERIOD (5)
    /* Defines number of lines to be executed every 1ms in Task0 */
    #SET SCRIPT_TASK0_EXECUTION_STEP (10)
    
    /**************************************************************/
    /*Script execution time for Task1 in 10ms, maximum value 65535                     */
    /**************************************************************/
    #SET SCRIPT_TASK1_EXECUTION_PERIOD (10)
    /*Defines number of lines to be executed every 10ms in Task1*/
    #SET SCRIPT_TASK1_EXECUTION_STEP (20)
    
    
    /**************************************************************/
    /* constant definition                                                                                             */
    /**************************************************************/
    CONST int VDCBus_RBrakeLevelOn = 3402;    /* 4095 = 499.42V, ratio = 0.12195. 415V = #3402 */
    CONST int VDCBus_RBrakeLevelOff = 3361;   /* 4095 = 499.42V, ratio = 0.12195. 420V = #3361 */
    
    CONST int VDCBus_RBrakePeriodMs = 5500;   /* = Ton / Period = 5500ms / 293ms */
    CONST int VDCBus_RBrakeIncStep = 190;     /* = Ton / Period = 5500ms / 293ms */
    
    /* RBrake FSM State constant */
    CONST int VDCBUS_RBRAKE_STATE_OFF = 0;
    CONST int VDCBUS_RBRAKE_STATE_ON = 1;
    
    /* Movement FSM state constant */
    CONST int FSM_STOP = 0;
    CONST int FSM_ON = 1;
    CONST int FSM_DECELERATING = 2;
    
    
    
    /**************************************************************/
    /* Global variable definition                                                                                    */
    /**************************************************************/
    int Modbus_Command;
    int VDCBus_RBrakeState;
    int   FSM_State;
    
    int Temp1;
    int Temp2;
    int Temp3;
    
    /**************************************************************/
    /* Task0 init function                                                                                             */
    /**************************************************************/
    Script_Task0_init()
    {
      /*Initialize global variable*/
      VDCBus_RBrakeState = VDCBUS_RBRAKE_STATE_OFF;
    
      /* local variable definition */
    
      /*Initialize local variable*/
    
      /* Initialize RBRake Output command */
      GPIO21_OUT = 0;
    }
    
    /**************************************************************/
    /* Task0 script function                                                                          */
    /**************************************************************/
    Script_Task0()
    {
    
      /*********************** RBrake FSM ****************************/
      if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_OFF)
      {
        /* Test if DCBus over pass limit */
        if (VdcFilt > VDCBus_RBrakeLevelOn)
        {
          GPIO21_OUT = 1;
          VDCBus_RBrakeState = VDCBUS_RBRAKE_STATE_ON;
        }
      } /* End if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_OFF)  */
    
      if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_ON)
      {
        if (VdcFilt < VDCBus_RBrakeLevelOff)
        {
          /* VDCBus is OK */
          GPIO21_OUT = 0;
          VDCBus_RBrakeState = VDCBUS_RBRAKE_STATE_OFF;
        }
      } /* End if (VDCBus_RBrakeState == VDCBUS_RBRAKE_STATE_ON) */
    }
    
    
    
    /**************************************************************/
    /* Task1 init function                                                                                             */
    /**************************************************************/
    Script_Task1_init()
    {
      /*Initialize global variable*/
      Modbus_Command = 0;
      FSM_State = FSM_STOP;
    
      /* local variable definition */
      int TargetVelocity;
    
      /*Initialize local variable*/
      int LocalCommand;
    
      LocalCommand = 0;
      AngleSelect = 2;  /* use rotor Flux Angle */
      CtrlModeSelect = 2; /*Speed control mode */
    
    }
    
    /**************************************************************/
    /* Task1 script function                                                                          */
    /* Ratio Speed 2730tr/min => #16384 => Ratio x 6                                  */
    /**************************************************************/
    Script_Task1()
    {
      Temp1 = abs_MotorSpeed;
      if (FSM_State == FSM_STOP)
      {
        /* Wait Modbus_Command On Off = On */
    
        if (Modbus_Command & 0x0200)  /* Motor On/Off */
        {
          /*Clear eventual PFC fault and start it */
          PFC_FaultClear = 1;
          PFC_Command = 1;
    
          FSM_State = FSM_ON;
    
          /* x10 because given in 10tr/min. x6 Tr/min -> Internal; */
          TargetSpeed = (Modbus_Command & 0x01FF) * 60;
    
          if   (Modbus_Command & 0x0400)
          {
            TargetSpeed = -TargetSpeed;
          }
    
          Command = 1;  /* Start the motor */
        }
      }
    
      if (FSM_State == FSM_ON)
      {
        /* Wait Modbus_Command On Off = Off */
        if ((Modbus_Command & 0x0200) == 0)
        {
          TargetSpeed = 0;
          FSM_State = FSM_DECELERATING;
        }
      }
    
      if (FSM_State == FSM_DECELERATING)
      {
        if (abs_MotorSpeed < (200 * 6))
        {
          /* Motor velocity is low, stop motor */
          Command = 0;
          FSM_State = FSM_STOP;
        }
      }
    }

  5. #5
    arnaud is on a distinguished road
    Join Date
    Aug 2020
    Posts
    17
    Points
    130
    Hello,
    Second try!
    I post message, but it indicate to me this message must be validated before apperas.
    2 days later, not yet validated.. :-(

    Then I try here by editing this message wihci was posted immediately..:

    In my message I say, Ok, I think is possible to manage RTS by script.
    But currently, I have a small script (given in quote in my original message) but with this small script, the cpu load already reach 100% (70% just with motor and PFC, then 30% remaining for the script)
    ...
    Is the administrator can post my messages?
    Last edited by arnaud; Sep 10th, 2020 at 10:50 PM.

  6. #6
    Intermediate Intermediate
    Infineon Employee
    Infineon Employee
    daanish is on a distinguished road
    Join Date
    Nov 2019
    Posts
    17
    Points
    360
    Hi,
    Not sure what the issue is with the forums - posting should work normally.
    The CPU load increase does not seem right. We'll look into your Script and provide feedback by end of Tue PST.
    Since you have unique requirements (more than 15 node addresses, flow control in UART), have you considered using IMC302A? You can add your own Modbus interface. Please see for peripheral use case examples.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  7. #7
    arnaud is on a distinguished road
    Join Date
    Aug 2020
    Posts
    17
    Points
    130
    HEllo,

    - The post where I copy my script is not displayed from my point of view. Where do you get it?

    - For the IMC302A, If I well understand, It is the same MCE than IMC102T, but with a C language programation in more tha Script engine. Then we could program easily some C function to make our own modebus RTU. Right?

  8. #8
    Intermediate Intermediate
    Infineon Employee
    Infineon Employee
    daanish is on a distinguished road
    Join Date
    Nov 2019
    Posts
    17
    Points
    360
    Hi Arnaud,

    It appears your post was tagged as a moderated post and only would show up if you or I log in. I will inquire with the forum administrators about this "feature"/bug.

    We are still investigating the Script CPU load issue. How much additional functionality are you looking to implement in Script? You may direct message me instead of writing publicly here.

    Thanks!
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


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 Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves 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.