TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320C6678: TMS320C6678网络中断问题:核0创建任务后Ping失败

Part Number:TMS320C6678

开发环境:CCS 12.0.0,硬件:EVM-TMDSEVM6678L复现步骤:1. 启动网络协议栈
2. 在核0创建打印任务(Task_create())
3. Ping 192.168.1.1 → 返回"Destination Host Unreachable"代码如下:void init_sgmii (uint32_t macPortNum)
{
int32_t wait_time;
CSL_SGMII_ADVABILITY sgmiiCfg; // Structure to hold SGMII advanced capabilities
CSL_SGMII_STATUS sgmiiStatus; // Structure to hold SGMII status

// Set SGMII PLL configuration
CSL_BootCfgSetSGMIIConfigPLL(0x00000051);

// Introduce a delay for PLL stabilization
cpu_delaycycles(100);

// Configure SGMII RX settings
CSL_BootCfgSetSGMIIRxConfig(macPortNum, 0x00700621);

// Configure SGMII TX settings
CSL_BootCfgSetSGMIITxConfig(macPortNum, 0x000108A1);
wait_time = 1000; // Set wait time for link status check
while(wait_time) {
// Get the SGMII status
CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
if (sgmiiStatus.bIsLocked == 1) {
break; // Break if SGMII is locked
} else {
cpu_delaycycles(1000); // Delay before retrying
wait_time–; // Decrement wait time
}
}

if(wait_time == 0) {
// Print an error message if timeout occurs
System_printf("configure sgmii0 serdes time out!\n");
return; // Exit the function
}

// Reset the port before configuration
CSL_SGMII_doSoftReset(macPortNum);
while(CSL_SGMII_getSoftResetStatus(macPortNum) != 0); // Wait for reset to complete

CSL_SGMII_startRxTxSoftReset(macPortNum); // Start RX/TX soft reset
CSL_SGMII_disableMasterMode(macPortNum); // Disable master mode
CSL_SGMII_enableAutoNegotiation(macPortNum); // Enable auto-negotiation
CSL_SGMII_endRxTxSoftReset(macPortNum); // End RX/TX soft reset

// Set SGMII configuration parameters
sgmiiCfg.linkSpeed = CSL_SGMII_1000_MBPS; // Set link speed to 1 Gbps
sgmiiCfg.duplexMode = CSL_SGMII_FULL_DUPLEX; // Set duplex mode to full duplex
sgmiiCfg.bLinkUp = 1; // Set link status to up
CSL_SGMII_setAdvAbility(macPortNum, &sgmiiCfg); // Apply the advanced capabilities

// Wait until the link is up
do {
CSL_SGMII_getStatus(macPortNum, &sgmiiStatus); // Get the latest status
} while(sgmiiStatus.bIsLinkUp != 1); // Loop until the link is up
return; // Exit function
}

Void NDKMain(UArg arg0, UArg arg1)
{
HANDLE hCfg; // Handle for configuration
Int status; // Variable to hold status codes
QMSS_CFG_T qmss_cfg; // Structure for QMSS configuration
CPPI_CFG_T cppi_cfg; // Structure for CPPI configuration
PowerUpDomains(); // Activate power domains
testMDIOAccess(); // Test MDIO access

PLATFORM_EMAC_EXT_info emac_info; // Information structure for EMAC
platform_get_emac_info(0, &emac_info); // Get EMAC information

// Initialize SGMII for MAC port 0 and 1
init_sgmii(0);
init_sgmii(1);
C6678_Init_SGMII_Auto(0); // Auto-initialize SGMII for C6678
TSC_delay_us(1000); // Introduce a delay

// Set QMSS configuration parameters
qmss_cfg.master_core = 1; // Master core ID qmss_cfg.max_num_desc = MAX_NUM_DESC; // Maximum number of descriptors
qmss_cfg.desc_size = MAX_DESC_SIZE; // Descriptor size
qmss_cfg.mem_region = Qmss_MemRegion_MEMORY_REGION0; // Memory region to be used

// Initialize QMSS and check for errors
if (res_mgr_init_qmss(&qmss_cfg) != 0)
{
free_net(0); // Clean up on failure
System_abort("res_mgr_init_qmss failed\n");
}

// Set CPPI configuration parameters
cppi_cfg.master_core = 1; // Master core ID
cppi_cfg.dma_num = Cppi_CpDma_PASS_CPDMA; // CPDMA number
cppi_cfg.num_tx_queues = NUM_PA_TX_QUEUES; // Number of TX queues
cppi_cfg.num_rx_channels = NUM_PA_RX_CHANNELS; // Number of RX channels

// Initialize CPPI and check for errors
if (res_mgr_init_cppi(&cppi_cfg) != 0)
{
free_net(0); // Clean up on failure
System_abort("res_mgr_init_cppi failed\n");
}

// Initialize PASS and check for errors
if (res_mgr_init_pass() != 0)
{
free_net(0); // Clean up on failure
System_abort("res_mgr_init_pass failed\n");
}

// Open the network control system
status = NC_SystemOpen(NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT);
if(status != NC_OPEN_SUCCESS)
{
free_net(0); // Clean up on failure
System_abort("NC_SystemOpen failed\n");
}

// Create a new configuration
hCfg = CfgNew();
if(!hCfg)
{
free_net(hCfg); // Clean up on failure
System_abort("CfgNew failed Unable to create configuration\n");
}

// Validate the length of the supplied names
if(strlen(DomainName) >= CFG_DOMAIN_MAX ||
strlen(HostName) >= CFG_DOMAIN_MAX)
{
free_net(hCfg); // Clean up on failure
System_abort("Domain or Host Name too long\n");
}

// Add global hostname to hCfg for all connected domains
CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
strlen(HostName), (UINT8 *)HostName, 0);

CI_ROUTE RT; // Route structure
IPN IPTmp; // Temporary IP structure

// Setup an IP address for the EVM
bzero(&NA, sizeof(NA)); // Zero memory for NA structure
NA.IPAddr = inet_addr(EVMStaticIP); // Assign static IP address
NA.IPMask = inet_addr(LocalIPMask); // Assign subnet mask
strcpy(NA.Domain, DomainName); // Assign domain name

// Add the address to interface 1
CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0);

// Add the default gateway (back to user PC)
bzero(&RT, sizeof(RT)); // Zero memory for route structure

RT.IPDestAddr = inet_addr(PCStaticIP); // Set destination IP address
RT.IPDestMask = inet_addr(LocalIPMask); // Set destination mask
RT.IPGateAddr = inet_addr(GatewayIP); // Set gateway IP address

// Add the route
CfgAddEntry(hCfg, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (UINT8 *)&RT, 0);

// Manually add the DNS server if specified
IPTmp = inet_addr(DNSServer);
if(IPTmp)
CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0);

// Set debug message level
status = DBG_WARN; // Set debug level to warning
CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&status, 0);

// UDP Receive limit
status = 8192; // Set a limit for received UDP packets
CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT, CFG_ADDMODE_UNIQUE,
sizeof(uint), (UINT8 *)&status, 0);

// Start network
do
{
status = NC_NetStart(hCfg, NetworkOpen, NetworkClose, NetworkIPAddr);
printf("NC_NetStart() status: %d\n", status); // Print the network start status
TSC_delay_us(5); // A small delay
} while(status > 0); // Retry until success
}

void main()
{
if(DNUM == 0) // Check if this is core number 0
{
// Create tasks for NDKMain and printTest with specified priority and stack
createTask(NDKMain, 7, 0x1000, "NDKMain"); // NDK main task
createTask(printTest, 4, 0x1000, "printTest"); // Print test task
}
}

Taylor:

您好,

已经收到了您的案例,调查需要些时间,感谢您的耐心等待。

赞(0)
未经允许不得转载:TI中文支持网 » TMS320C6678: TMS320C6678网络中断问题:核0创建任务后Ping失败
分享到: 更多 (0)