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.

CCS/TMS320C6678: SRIO response timeout

Part Number: TMS320C6678

Tool/software: Code Composer Studio

Hello

I have C6678 (TMDXEVM6678L v2.0) connected to FPGA (Virtex6 ipcore Serial RapidIO Gen2 v1.7).

I'm trying to run a simple write-read test:

1. C6678 write data to FPGA (NWRITE or NWRITE_R)

2. C6678 read data back (NREAD)

3. Check data

Results:

1. Write operation:

FPGA: data successfully received and stored in memory, if FTYPE = NWRITE_R fpga sends response

C6678: if FTYPE = NWRITE_R completion code = 1 (timeout)

2. Read operation

FPGA: read request successfully received, fpga reads data from memory and sends response with data

C6678: completion code = 1 (timeout), no data received

After sending the response FPGA receives PA-symbol (Packet Accepted)

Why c6678 does not accept responses from FPGA?

  • Hi,

    I've notified the RTOS team. Their feedback will be posted directly here.

    Best Regards,
    Yordan
  • Yuriy,

    There are many threads in the forum discussing the SRIO topic on C6678 and FPGA, for example: e2e.ti.com/.../399863
    Which code base are you working with?

    Regards,
    Garrett
  • Garrett, thank you for your reply.

    I use code based on "loopbackDioIsr" example.

    int32_t SrioDevice_init (void)
    {
        CSL_SrioHandle      hSrio;
    	int32_t             i, j;
        SRIO_PE_FEATURES    peFeatures;
        SRIO_OP_CAR         opCar;
        Qmss_QueueHnd       queueHnd;
        Qmss_Queue			queueInfo;
        Bool 				sameGarbageQ;
        uint8_t             isAllocated;
        uint32_t            garbageQueue[] = { GARBAGE_LEN_QUEUE,  GARBAGE_TOUT_QUEUE,
                                                GARBAGE_RETRY_QUEUE,GARBAGE_TRANS_ERR_QUEUE,
                                                GARBAGE_PROG_QUEUE, GARBAGE_SSIZE_QUEUE };
    
        uint32_t srioIdMask = (srioDeviceConfig.isDeviceId16b ? 0xFFFF : 0xFF);
        uint32_t srioPrimaryId = srioDeviceConfig.id1;
        uint32_t srioSecondaryId = srioDeviceConfig.id2;
    
    
    /* Reset SRIO */
    #ifndef SIMULATOR_SUPPORT
        /* Disable SRIO reset isolation */
        if (CSL_PSC_isModuleResetIsolationEnabled(CSL_PSC_LPSC_SRIO))
        	CSL_PSC_disableModuleResetIsolation(CSL_PSC_LPSC_SRIO);
    
        /* Reset SRIO module and wait for the reset to complete */
        CSL_PSC_setModuleLocalReset (CSL_PSC_LPSC_SRIO,PSC_MDLRST_ASSERTED);
        CSL_PSC_setModuleNextState (CSL_PSC_LPSC_SRIO,PSC_MODSTATE_ENABLE);
        System_printf ("Debug: Waiting for module reset...\n");
        System_flush();
        while (!CSL_PSC_isModuleResetDone(CSL_PSC_LPSC_SRIO));
        System_printf ("Debug: Waiting for module local reset...\n");
        System_flush();
        while (!CSL_PSC_isModuleLocalResetDone (CSL_PSC_LPSC_SRIO));
    #endif
    
    
    
        /* Get the CSL SRIO Handle. */
        hSrio = CSL_SRIO_Open (0);
        if (hSrio == NULL)
            return -1;
     
        /* Enable reception of packets */
    	hSrio->RIO_PCR = (hSrio->RIO_PCR & 0x7) | CSL_SRIO_RIO_PCR_RESTORE_MASK;
    
        /* Disable the SRIO Global block */
       	CSL_SRIO_GlobalDisable (hSrio);
       	
       	/* Disable each of the individual SRIO blocks. */
       	for(i = 0; i <= 9; i++)
       		CSL_SRIO_DisableBlock(hSrio, i);
    
        /* Set boot complete to be 0; we are not done with the initialization. */	
    	CSL_SRIO_SetBootComplete(hSrio, 0);
    
    	CSL_SRIO_SetLSUShadowRegs(hSrio, 0x19, 0x19);
    
        /* Now enable the SRIO block and all the individual blocks also. */
        CSL_SRIO_GlobalEnable (hSrio);
        for(i = 0; i <= 9; i++)
            CSL_SRIO_EnableBlock(hSrio,i);
    
        if(srioDeviceConfig.isLoopbackMode){
        	/* Configure SRIO ports to operate in loopback mode. */
    		CSL_SRIO_SetLoopbackMode(hSrio, 0);
    		CSL_SRIO_SetLoopbackMode(hSrio, 1);
    		CSL_SRIO_SetLoopbackMode(hSrio, 2);
    		CSL_SRIO_SetLoopbackMode(hSrio, 3);
        }else{
        	/* Configure SRIO ports to operate in normal mode. */
        	CSL_SRIO_SetNormalMode(hSrio, 0);
        	CSL_SRIO_SetNormalMode(hSrio, 1);
        	CSL_SRIO_SetNormalMode(hSrio, 2);
        	CSL_SRIO_SetNormalMode(hSrio, 3);
        }
    
    	/* Enable Automatic Priority Promotion of response packets. */
    	CSL_SRIO_EnableAutomaticPriorityPromotion(hSrio);
    
    	/* Set the SRIO Prescalar select to operate in the range of 44.7 to 89.5 */
    	CSL_SRIO_SetPrescalarSelect (hSrio, 0);
    
        /* Unlock the Boot Configuration Kicker */
        CSL_BootCfgUnlockKicker ();
    
        if (setEnableSrioPllRxTx(hSrio, srioDeviceConfig.refClock, srioDeviceConfig.laneRate, srioDeviceConfig.isLoopbackMode) < 0)
        	return -1;
    
    #ifndef SIMULATOR_SUPPORT
        /* Loop around till the SERDES PLL is not locked. */
        while (1)
        {
            uint32_t    status;
    
            /* Get the SRIO SERDES Status */
            CSL_BootCfgGetSRIOSERDESStatus(&status);
            if (status & 0x1)
                break;
        }
    #endif
    
        /* Clear the LSU pending interrupts. */
        CSL_SRIO_ClearLSUPendingInterrupt (hSrio, 0xFFFFFFFF, 0xFFFFFFFF);
    
        /* Set the Device Information */
        CSL_SRIO_SetDeviceInfo (hSrio, srioPrimaryId, DEVICE_VENDOR_ID, DEVICE_REVISION);
    
        /* Set the Assembly Information */
        CSL_SRIO_SetAssemblyInfo(hSrio, DEVICE_ASSEMBLY_ID, DEVICE_ASSEMBLY_VENDOR_ID, 
                                 DEVICE_ASSEMBLY_REVISION, DEVICE_ASSEMBLY_INFO);
    
        /* TODO: Configure the processing element features
         *  The SRIO RL file is missing the Re-transmit Suppression Support (Bit6) field definition */
        peFeatures.isBridge                          = 0;
        peFeatures.isEndpoint                        = 0;
        peFeatures.isProcessor                       = 1;
        peFeatures.isSwitch                          = 0;
        peFeatures.isMultiport                       = 0;
        peFeatures.isFlowArbiterationSupported       = 0;
        peFeatures.isMulticastSupported              = 0;
        peFeatures.isExtendedRouteConfigSupported    = 0;
        peFeatures.isStandardRouteConfigSupported    = 1;
        peFeatures.isFlowControlSupported            = 1;
        peFeatures.isCRFSupported                    = 0;
        peFeatures.isCTLSSupported                   = 1;
        peFeatures.isExtendedFeaturePtrValid         = 1;
        peFeatures.numAddressBitSupported            = 1;
        CSL_SRIO_SetProcessingElementFeatures (hSrio, &peFeatures);
    
        /* Configure the source operation CAR */
        memset ((void *) &opCar, 0, sizeof (opCar));
        opCar.portWriteOperationSupport = 1;
        opCar.atomicClearSupport        = 1;
        opCar.atomicSetSupport          = 1;
        opCar.atomicDecSupport          = 1;
        opCar.atomicIncSupport          = 1;
        opCar.atomicTestSwapSupport     = 1;
        opCar.doorbellSupport           = 1;
        opCar.dataMessageSupport        = 1;
        opCar.writeResponseSupport      = 1;
        opCar.streamWriteSupport        = 1;
        opCar.writeSupport              = 1;
        opCar.readSupport               = 1;
        opCar.dataStreamingSupport      = 1;
        CSL_SRIO_SetSourceOperationCAR (hSrio, &opCar);
    
        /* Configure the destination operation CAR */
    	memset ((void *) &opCar, 0, sizeof (opCar));
        opCar.portWriteOperationSupport  = 1;
        opCar.doorbellSupport            = 1;
        opCar.dataMessageSupport         = 1;
        opCar.writeResponseSupport       = 1;
        opCar.streamWriteSupport         = 1;
        opCar.writeSupport               = 1;
        opCar.readSupport                = 1;
        CSL_SRIO_SetDestOperationCAR (hSrio, &opCar);
    
        /* Set the 16 bit and 8 bit identifier for the SRIO Device. */
        CSL_SRIO_SetDeviceIDCSR (hSrio, DEVICE_ID1_8BIT, DEVICE_ID1_16BIT);
    
        /* Enable TLM Base Routing Information for Maintainance Requests & ensure that
         * the BRR's can be used by all the ports. */
        CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 0, 1, 1, 1, 0);
    
        if(srioDeviceConfig.isLoopbackMode)
        	CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 0, 2, 1, 1, 0);
    
        /* Configure the Base Routing Register to ensure that all packets matching the 
         * Device Identifier & the Secondary Device Id are admitted. */
        CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 0, 1, srioPrimaryId, srioIdMask);
        if(srioDeviceConfig.isLoopbackMode)
        	CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 0, 2, srioSecondaryId, srioIdMask);
    
        /* We need to open the Garbage collection queues in the QMSS. This is done to ensure that 
         * these queues are not opened by another system entity. */
        for (i = 0; i < 6; i++)
        {
            /* Open the Garabage queues */
            queueHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, garbageQueue[i], &isAllocated);
            if (queueHnd < 0)
                return -1;
    
            /* Make sure the queue has not been opened already; we dont the queues to be shared by some other
             * entity in the system. */
            if (isAllocated > 1){
    
            	sameGarbageQ = FALSE;
            	queueInfo = Qmss_getQueueNumber(queueHnd);
    
            	for(j = 0; j < i; j++){
            		if(queueInfo.qNum == garbageQueue[j])
            			sameGarbageQ = TRUE;
            	}
            	if(!sameGarbageQ)
            		return -1;
            }
    
    
        }
    
        /* Set the Transmit Garbage Collection Information. */
        CSL_SRIO_SetTxGarbageCollectionInfo (hSrio, GARBAGE_LEN_QUEUE, GARBAGE_TOUT_QUEUE, 
                                             GARBAGE_RETRY_QUEUE, GARBAGE_TRANS_ERR_QUEUE, 
                                             GARBAGE_PROG_QUEUE, GARBAGE_SSIZE_QUEUE);
    
        /* Set the Host Device Identifier. */
        CSL_SRIO_SetHostDeviceID (hSrio, srioPrimaryId);
    
        /* Configure the component tag CSR */
        CSL_SRIO_SetCompTagCSR (hSrio, 0x00000000);
    
        SRIO_PLM_VMIN_EXPONENT vminExponentConfig;
    
        /* Configure the PLM for all the ports. */
    	for (i = 0; i < 4; i++)
    	{
    	    /* Set the PLM Port Silence Timer. */	
            CSL_SRIO_SetPLMPortSilenceTimer (hSrio, i, 0x2);
    
            /* TODO: We need to ensure that the Port 0 is configured to support both
             * the 2x and 4x modes. The Port Width field is read only. So here we simply
             * ensure that the Input and Output ports are enabled. */
            CSL_SRIO_EnableInputPort (hSrio, i);
            CSL_SRIO_EnableOutputPort (hSrio, i);
    
            /* Set the PLM Port Discovery Timer. */
            CSL_SRIO_SetPLMPortDiscoveryTimer (hSrio, i, 0x2);
    
            /* Reset the Port Write Reception capture. */
            CSL_SRIO_SetPortWriteReceptionCapture(hSrio, i, 0x0);
    
            /* VMIN patch */
            CSL_SRIO_GetPLMPortVMinExponentConfig(hSrio, i, &vminExponentConfig);
            vminExponentConfig.vminExp = 15;
            CSL_SRIO_SetPLMPortVMinExponentConfig(hSrio, i, &vminExponentConfig);
    
    
        }
    
        /* Set the Port link timeout CSR */
        CSL_SRIO_SetPortLinkTimeoutCSR (hSrio, 0xFF0FFF);
        CSL_SRIO_SetPortResponseTimeoutCSR(hSrio, 0xFF0FFF);
    
        /* Set the Port General CSR: Only executing as Master Enable */
        CSL_SRIO_SetPortGeneralCSR (hSrio, 0, 1, 0);
    
        /* Clear the sticky register bits. */
        CSL_SRIO_SetLLMResetControl (hSrio, 1);
    
        /* Set the device id to be 0 for the Maintenance Port-Write operation 
         * to report errors to a system host. */
        CSL_SRIO_SetPortWriteDeviceId (hSrio, 0x0, 0x0, 0x0);
    
        /* Set the Data Streaming MTU */
        CSL_SRIO_SetDataStreamingMTU (hSrio, 64);
    
        /* Configure the path mode for the ports. */
        if (setSrioLanes(hSrio, srioDeviceConfig.laneMode) < 0)
        	return -1;
    
        /* Set the LLM Port IP Prescalar. */
        //CSL_SRIO_SetLLMPortIPPrescalar (hSrio, 0x21);
        CSL_SRIO_SetLLMPortIPPrescalar (hSrio, 0x1F);
    
        // ?? watermarks
    	for (i = 0; i < 4; i++)
    	{
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 0, 0x24, 0x24);
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 1, 0x1B, 0x1B);
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 2, 0x12, 0x12);
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 3, 0x9, 0x9);
    	}
    
    	for(i = 0; i < 24; i++)
    		CSL_SRIO_DisableInterruptPacing(hSrio, i);
    
    	for(i = 0; i < 16; i++)
    		CSL_SRIO_SetTxQueueSchedInfo(hSrio, i, 0, 0);
    
    	CSL_SRIO_SetDoorbellRoute(hSrio, 1);
    
    	for(i = 0; i < 16; i++)
    	{
    		CSL_SRIO_RouteDoorbellInterrupts(hSrio, 0, i, 0);
    		CSL_SRIO_RouteDoorbellInterrupts(hSrio, 1, i, 1);
    		CSL_SRIO_RouteDoorbellInterrupts(hSrio, 2, i, 2);
    		CSL_SRIO_RouteDoorbellInterrupts(hSrio, 3, i, 3);
    	}
    
        /* Enable the peripheral. */
        CSL_SRIO_EnablePeripheral(hSrio);
    
        /* Configuration has been completed. */
        CSL_SRIO_SetBootComplete(hSrio, 1);
    
    #ifndef SIMULATOR_SUPPORT
        /* This code checks if the ports are operational or not. The functionality is not supported 
         * on the simulator. */    
        if (waitAllSrioPortsOperational(hSrio, srioDeviceConfig.laneMode) < 0)
        		return -1;
    #endif
    
        if (displaySrioLanesStatus(hSrio) < 0)
            	return -1;
    
    
        /* Initialization has been completed. */
        return 0;
    }

    Driver Configuration

    Int32 _configDrvSrioDrv(Srio_DrvConfig* config)
    {
    	UInt32 coreNum = platformGetCoreNum();
    	UInt8 isAllocated;
    
    	/* Initialize the SRIO Driver Configuration. */
    	memset ((Void *)config, 0, sizeof(Srio_DrvConfig));
    
    	/* Initialize the OSAL */
    	if (Osal_dataBufferInitMemory(SRIO_MAX_MTU) < 0)
    	{
    		System_printf ("Error: Unable to initialize the OSAL. \n");
    		return -1;
    	}
    
    	/********************************************************************************
    	 * The SRIO Driver Instance is going to be created with the following properties:
    	 * - Driver Managed
    	 * - Interrupt Support (Pass the Rx Completion Queue as NULL)
    	 ********************************************************************************/
    
    	/* Setup the SRIO Driver Managed Configuration. */
    	config->bAppManagedConfig = FALSE;
    
    	/* Driver Managed: Receive Configuration */
    	config->u.drvManagedCfg.bIsRxCfgValid             = 1;
    	config->u.drvManagedCfg.rxCfg.rxMemRegion         = Qmss_MemRegion_MEMORY_REGION0;
    	config->u.drvManagedCfg.rxCfg.numRxBuffers        = 4;
    	config->u.drvManagedCfg.rxCfg.rxMTU               = SRIO_MAX_MTU;
    
    	/* Accumulator Configuration. */
    	{
    		int32_t coreToQueueSelector[4];
    
    	  /* This is the table which maps the core to a specific receive queue. */
    		coreToQueueSelector[0] = 704;
    		coreToQueueSelector[1] = 705;
    		coreToQueueSelector[2] = 706;
    		coreToQueueSelector[3] = 707;
    
    		/* Since we are programming the accumulator we want this queue to be a HIGH PRIORITY Queue */
    		config->u.drvManagedCfg.rxCfg.rxCompletionQueue = Qmss_queueOpen (Qmss_QueueType_HIGH_PRIORITY_QUEUE,
    																		 coreToQueueSelector[coreNum], &isAllocated);
    		if (config->u.drvManagedCfg.rxCfg.rxCompletionQueue < 0)
    		{
    			System_printf ("Error: Unable to open the SRIO Receive Completion Queue\n");
    			return -1;
    		}
    
    		/* Accumulator Configuration is VALID. */
    		config->u.drvManagedCfg.rxCfg.bIsAccumlatorCfgValid = 1; // 1 if interrupt mode, 0 if polled mode
    
    		/* Accumulator Configuration. */
    		config->u.drvManagedCfg.rxCfg.accCfg.channel             = coreNum;
    		config->u.drvManagedCfg.rxCfg.accCfg.command             = Qmss_AccCmd_ENABLE_CHANNEL;
    		config->u.drvManagedCfg.rxCfg.accCfg.queueEnMask         = 0;
    		config->u.drvManagedCfg.rxCfg.accCfg.queMgrIndex         = coreToQueueSelector[coreNum];
    		config->u.drvManagedCfg.rxCfg.accCfg.maxPageEntries      = 2;
    		config->u.drvManagedCfg.rxCfg.accCfg.timerLoadCount      = 0;
    		config->u.drvManagedCfg.rxCfg.accCfg.interruptPacingMode = Qmss_AccPacingMode_LAST_INTERRUPT;
    		config->u.drvManagedCfg.rxCfg.accCfg.listEntrySize       = Qmss_AccEntrySize_REG_D;
    		config->u.drvManagedCfg.rxCfg.accCfg.listCountMode       = Qmss_AccCountMode_ENTRY_COUNT;
    		config->u.drvManagedCfg.rxCfg.accCfg.multiQueueMode      = Qmss_AccQueueMode_SINGLE_QUEUE;
    
    		/* Initialize the accumulator list memory */
    		memset ((Void *)&gHiPriAccumList[0], 0, sizeof(gHiPriAccumList));
    		config->u.drvManagedCfg.rxCfg.accCfg.listAddress = l2_global_address((UInt32)&gHiPriAccumList[0]);
    	}
    
    	/* Driver Managed: Transmit Configuration */
    	config->u.drvManagedCfg.bIsTxCfgValid             = 1;
    	config->u.drvManagedCfg.txCfg.txMemRegion         = Qmss_MemRegion_MEMORY_REGION0;
    	config->u.drvManagedCfg.txCfg.numTxBuffers        = 4;
    	config->u.drvManagedCfg.txCfg.txMTU               = SRIO_MAX_MTU;
    
    	return 0;
    }
    

    Requests

    int32_t sendDIO(SrioModule_t* module, Srio_SockAddrInfo* to, uint32_t localAddress, uint32_t size)
    {
    	Srio_SockHandle socket;
    	Srio_SockBindAddrInfo bindInfo;
    
    	// open socket
    	socket = Srio_sockOpen(module->driver, Srio_SocketType_DIO, FALSE);
    	if(socket == NULL)
    	{
    		return -1;
    	}
    
    	// config socket
    	bindInfo.dio.doorbellValid = 0;
    	bindInfo.dio.intrRequest = 1;
    	bindInfo.dio.supInt = 0;
    	bindInfo.dio.xambs = 0;
    	bindInfo.dio.priority = 0;
    	bindInfo.dio.outPortID = 0;
    	bindInfo.dio.idSize = (module->deviceConfig->isDeviceId16b ? 1 : 0);
    	bindInfo.dio.srcIDMap = 0;
    	bindInfo.dio.hopCount = 0;
    	bindInfo.dio.doorbellBit = 0;
    	bindInfo.dio.doorbellReg = 0;
    
    	if(Srio_sockBind(socket, &bindInfo)) {
    		return -1;
    	}
    
    	// clear interrupt flag
    	module->dioIntr = 0;
    
    	// send packet
    	if(Srio_sockSend(socket, (Srio_DrvBuffer)localAddress, size, to) < 0)
    	{
    		return -1;
    	}
    
    	// Waiting completion
    	while(module->dioIntr == 0);
    
    	/* Read the completion code filled by the ISR */
    	uint8_t compCode = 0xFF;
    	if (Srio_getSockOpt(socket, Srio_Opt_DIO_READ_SOCK_COMP_CODE, &compCode, sizeof(uint8_t)) < 0)
    	{
    		//System_printf ("Error: Unable to read the completion code in socket\n");
    		return -1;
    	}
    	// close socket
    	Srio_sockClose(socket);
    	return compCode;
    }
    
    
    int32_t srioSendNWrite(SrioModule_t* module, uint32_t remoteAddress, uint32_t localAddress, uint32_t size)
    {
    	Srio_SockAddrInfo to;
    	// Config packet header
    	to.dio.rapidIOMSB = 0x0;
    	to.dio.rapidIOLSB = remoteAddress;
    	to.dio.dstID = module->deviceConfig->id2;
    	to.dio.ttype = Srio_Ttype_Write_NWRITE_R; // or Srio_Ttype_Write_NWRITE
    	to.dio.ftype = Srio_Ftype_WRITE;
    
    	return sendDIO(module, &to, localAddress, size);
    }
    
    int32_t srioSendNRead(SrioModule_t* module, uint32_t remoteAddress, uint32_t localAddress, uint32_t size)
    {
    	Srio_SockAddrInfo to;
    
    	// Config packet header
    	to.dio.rapidIOMSB = 0x0;
    	to.dio.rapidIOLSB = remoteAddress;
    	to.dio.dstID = module->deviceConfig->id2;
    	to.dio.ttype = Srio_Ttype_Request_NREAD;
    	to.dio.ftype = Srio_Ftype_REQUEST;
    
    	return sendDIO(module, &to, localAddress, size);
    }
    

  • Yuriy,

    Have you looked into this thread and check if it applies to you?
    e2e.ti.com/.../1465780

    Regards,
    Garrett
  • Garrett,

    Yes, I looked that thread, but it didn't help for me.

    I have LOCAL_DIS = 0 and PEREN = 1, so no need to set RESTORE bit

    Additionally, I run write-read test with FPGA as initiator (FPGA writes to DSP and then reads from DSP), and it's work properly.

    Also, I use DOORBELLs that work in two way successfully (but I don't check TX completion code - so maybe it's also timeout) .

    I increase the timeout delay to maximum (0xFFFFFF), but it didn't help

    What else should I check also?