industrialNETworXnetx

Rainer Versteeg

Rainer Versteeg

| 05.12.2008 | 14:04 | 9 replies

Profbus Stack on XC = 0

Hello,

Is it possible to run the Profibus Stack over XC = 0 ?

Br,
Rainer

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 05.12.2008 | 14:36

Hi,

this should work.

Rainer Versteeg

Rainer Versteeg

| 05.12.2008 | 14:42

Hi AJ,

I have the problem that the command

if ((eRslt = TLR_QUE_IDENTIFY("PB_FSPMS_QUE", ptRsc->tLoc.uTskInst, &ptRsc->tLoc.tMscy1s.tLnkDst)) != TLR_S_OK)
  {
    goto leave;
  }

gives me a result != TLR_S_OK

I have set the XC Instance to 0 and the XC Interrupt to 0.

Have i missing anything else ?

Br,
Rainer

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 05.12.2008 | 14:53

What about the "XC-Instances"?

STATIC CONST FAR RX_XC_SET_T atrXXc[] = 
{
  {{"XPEC",RX_PERIPHERAL_TYPE_XC,0},                  /* Instance 0                             */
    RX_XC_TYPE_XPEC,                                  /* Type of XC unit is xPEC                */
    0,                                                /* XC channel 0                           */
    XC_CODE_PROFIBUS_SLAVE_XPEC0                      /* PBS microcode xPEC start address       */
  },
  {{"XMACRPU",RX_PERIPHERAL_TYPE_XC,0},               /* Instance 0                             */
    RX_XC_TYPE_XMACRPU,                               /* Type of XC unit is xMAC                */
    0,                                                /* XC channel 2                           */
    XC_CODE_PROFIBUS_SLAVE_RPU0                       /* PBS microcode xRPU start address       */
  },
  {{"XMACTPU",RX_PERIPHERAL_TYPE_XC,0},               /* Instance 0                             */
    RX_XC_TYPE_XMACTPU,                               /* Type of XC unit is xMAC                */
    0,                                                /* XC channel 2                           */
    XC_CODE_PROFIBUS_SLAVE_TPU0                       /* PBS microcode xTPU start address       */
  }
};

Rainer Versteeg

Rainer Versteeg

| 05.12.2008 | 15:03

Hi, AJ

The XC Instanc and the Interrupt is set to 0:

void START_TASK_PROFIBUS()
{
 //========  Definition XPEC & MAC Instanzen =================   
 
  RX_XC_SET_T atMyXc[] = 
  {{{"XPEC", RX_PERIPHERAL_TYPE_XC, XC_INST_PROFIBUS},
     RX_XC_TYPE_XPEC,
     XC_INST_DEVICENET,
     #if (XC_INST_PROFIBUS==0)
      XC_CODE_PROFIBUS_SLAVE_XPEC0
     #endif 
     /*
     #if (XC_INST_PROFIBUS==1)
      XC_CODE_PROFIBUS_SLAVE_XPEC1
     #endif 
     #if (XC_INST_PROFIBUS==2)
      XC_CODE_PROFIBUS_SLAVE_XPEC2
     #endif  
     */
  }};
  RX_XC_SET_T atMyXc1[] =  
  {{{"XMACRPU", RX_PERIPHERAL_TYPE_XC, XC_INST_PROFIBUS},
     RX_XC_TYPE_XMACRPU,
     XC_INST_PROFIBUS,
     #if (XC_INST_PROFIBUS==0)
      XC_CODE_PROFIBUS_SLAVE_RPU0
     #endif 
     /*
     #if (XC_INST_PROFIBUS==1)
      XC_CODE_PROFIBUS_SLAVE_RPU1
     #endif 
     #if (XC_INST_PROFIBUS==2)
      XC_CODE_PROFIBUS_SLAVE_RPU2
     #endif  */
  }};
  RX_XC_SET_T atMyXc2[] = 
  {{{"XMACTPU", RX_PERIPHERAL_TYPE_XC, XC_INST_PROFIBUS},
    RX_XC_TYPE_XMACTPU,
    XC_INST_PROFIBUS,
    #if (XC_INST_PROFIBUS==0)
     XC_CODE_PROFIBUS_SLAVE_TPU0
    #endif 
    /*
    #if (XC_INST_PROFIBUS==1)
     XC_CODE_PROFIBUS_SLAVE_TPU1
    #endif 
    #if (XC_INST_PROFIBUS==2)
     XC_CODE_PROFIBUS_SLAVE_TPU2
    #endif 
    */
  }};
 
 //----------------------------------------------
 
 //========  Definition of the LED Instanzen =================   
 RX_LED_SET_T atMyLed1[] = { 
 {{"MNS_GRN", RX_PERIPHERAL_TYPE_LED, 0},
  {"SYSPIO", RX_PERIPHERAL_TYPE_LED, 0},
  {0},
  {0},
  {RX_LED_VALUE_TYPE_OR, 1, 0x10},
  {RX_LED_VALUE_TYPE_OR, 1, 0x10},
  Drv_PioSetupLedOperations,
  }
 };
 RX_LED_SET_T atMyLed2[] = { 
 {{"MNS_RED", RX_PERIPHERAL_TYPE_LED, 0},
  {"SYSPIO", RX_PERIPHERAL_TYPE_LED, 0},
  {0},
  {0},
  {RX_LED_VALUE_TYPE_OR, 2, 0x20},
  {RX_LED_VALUE_TYPE_OR, 2, 0x20},
  Drv_PioSetupLedOperations,
  }
 };
 //----------------------------------------------
 
 //========  Definition XPEC Intterrupt =================
 RX_INTERRUPT_SET_T myXPEC_Int[] = {
 {
  #if (XC_INST_PROFIBUS==0)  
  {"COM", RX_PERIPHERAL_TYPE_INTERRUPT, XC_INST_PROFIBUS}, // Communication Channel, Instance 0 
  SRT_NETX_VIC_IRQ_STAT_com0,                    // Use external communication channel 2 Interrupt 
  #endif
  /*
  #if (XC_INST_PROFIBUS==1)  
  {"COM", RX_PERIPHERAL_TYPE_INTERRUPT, XC_INST_PROFIBUS}, // Communication Channel, Instance 0 
  SRT_NETX_VIC_IRQ_STAT_com1,                    // Use external communication channel 2 Interrupt 
  #endif
  #if (XC_INST_PROFIBUS==2)  
  {"COM", RX_PERIPHERAL_TYPE_INTERRUPT, XC_INST_PROFIBUS}, // Communication Channel, Instance 0 
  SRT_NETX_VIC_IRQ_STAT_com2,                    // Use external communication channel 2 Interrupt 
  #endif
  */
  28,                                            // Priority 28                        
  RX_INTERRUPT_MODE_TASK,                        // Allow interrupt to be a thread     
  RX_INTERRUPT_EOI_AUTO,                         // EOI self by RX                     
  RX_INTERRUPT_TRIGGER_RISING_EDGE,              // Edge triggered                     
  RX_INTERRUPT_PRIORITY_STANDARD,                // Normal Priority                    
  RX_INTERRUPT_REENTRANCY_DISABLED,              // Interrupt itself is not reentrant  
  TSK_PRIO_7,                                    // Task Mode Priority                 
  TSK_TOK_7,                                     // Task Token                         
  1024                                           // Task Stack Size                    
 }   
 };  
 //---------------------------------------------- 
    
    
 TLR_RESULT  eRslt;       
 TLR_HANDLE  hXC; 
 TLR_HANDLE  hXC1; 
 TLR_HANDLE  hXC2; 
 TLR_HANDLE  hLed1;
 TLR_HANDLE  hLed2;
 TLR_HANDLE  hInt;
 
 //====== Interrupt für XPEC0 erzeugen ===========
 eRslt=rX_MemAllocateMemory(&hInt,DRV_INTERRUPT_SIZE);
 eRslt=Drv_IntCreateInterrupt(hInt, &myXPEC_Int[0]);
 //-----------------------------------------------
 
 //====== XPEC und XMAC Instanzen erzeugen =====
 eRslt=rX_MemAllocateMemory(&hXC,DRV_XC_SIZE);
 eRslt=rX_MemAllocateMemory(&hXC1,DRV_XC_SIZE);
 eRslt=rX_MemAllocateMemory(&hXC2,DRV_XC_SIZE);
 eRslt=Drv_XcCreateXc(hXC,&atMyXc[0]);
 eRslt=Drv_XcCreateXc(hXC1,&atMyXc1[0]);
 eRslt=Drv_XcCreateXc(hXC2,&atMyXc2[0]);
 //----------------------------------------------
 
 //====== LED Instanzen erzeugen ================
 eRslt=rX_MemAllocateMemory(&hLed1,DRV_LED_SIZE);
 eRslt=rX_MemAllocateMemory(&hLed2,DRV_LED_SIZE);
 eRslt=Drv_LedCreateLed(hLed1,&atMyLed1[0]);
 eRslt=Drv_LedCreateLed(hLed2,&atMyLed2[0]);
 //----------------------------------------------
 
 eRslt=rX_SysCreateTask("ProfibusAps", 
                       (void (FAR*)(void FAR*))TaskEnter_ProfibusAps, 
                       (void (FAR*)(void FAR*))(UINT32)&pvProfibusApsPrm,                   
                       (void*)&auTskStack_ProfibusAps[0],  
                       TSK_STACK_SIZE_PROFIBUS_APS,  
                       RX_TASK_AUTO_START_INIT_WAIT,   
                       0,
                       TSK_PRIO_35, TSK_TOK_35,      
                       2,       
	                   (void (*)(void*))NULL); 
 rXStartNextTask();    
}

When i set XC_INST_PROFIBUS to 2 then the ProfibusAps Task is running, when i set to 0 or 1 then the above error is created.

Br,
Rainer

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 05.12.2008 | 15:09

Quote:
RX_XC_SET_T atMyXc[] =
{{{"XPEC", RX_PERIPHERAL_TYPE_XC, XC_INST_PROFIBUS},
RX_XC_TYPE_XPEC,
XC_INST_DEVICENET,
#if (XC_INST_PROFIBUS==0)
XC_CODE_PROFIBUS_SLAVE_XPEC0
#endif
/*
#if (XC_INST_PROFIBUS==1)
XC_CODE_PROFIBUS_SLAVE_XPEC1
#endif
#if (XC_INST_PROFIBUS==2)
XC_CODE_PROFIBUS_SLAVE_XPEC2
#endif
*/
}};

There is an entry "XC_INST_DEVICENET" instead of "XC_INST_PROFIBUS". Maybe this is the problem. I can not see, what is behind this define.

It would be good to know the exact failure code of eResult.

Rainer Versteeg

Rainer Versteeg

| 05.12.2008 | 15:44

Hi Aj,

I have corrected the error but it does not run !

What does the result 906 Hex means ?

Br,
Rainer

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 05.12.2008 | 15:52

Hi,

the error 0x0906 means: RX_QUE_UNKNOWN

All error codes are listed in the rX_Results.h file.

Rainer Versteeg

Rainer Versteeg

| 05.12.2008 | 16:11

Hi AJ,

Thank you for the fast help !

I have found the error. I have declared the XC instance and the interrupt to XC instance.

RX_XC_SET_T atMyXc1[] =  
  {{{"XMACRPU", RX_PERIPHERAL_TYPE_XC, XC_INST_PROFIBUS},

When i do this then in the configuration of the task i must set the instance to XC_INST_PROFIBUS too.

 eRslt=rX_SysCreateTask("ProfibusAps", 
                       (void (FAR*)(void FAR*))TaskEnter_ProfibusAps, 
                       (void (FAR*)(void FAR*))(UINT32)&pvProfibusApsPrm,                   
                       (void*)&auTskStack_ProfibusAps[0],  
                       TSK_STACK_SIZE_PROFIBUS_APS,  
                       RX_TASK_AUTO_START_INIT_WAIT,   
                       0,
                       TSK_PRIO_35, TSK_TOK_35,      
                       XC_INST_PROFIBUS,       
	                   (void (*)(void*))NULL); 

Now it runs !!

Br,
Rainer

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 05.12.2008 | 19:02

:D Good news :D

Login