Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN
Tool/software:
I have two TMS570LC4357 Launchpad and I want to perform EMAC Communication between these two. I have used the same HalCOGen configuration as EMAC_Loopback example , except I have disabled loopback and changed the mac address for both launchpad. The issue is when I transmit from one launchpad and monitor TXGOODFRAMES Register then I get 0000000, which I believe, is not expected. Where could be the issue? Below is the code for Transmission .
#include "HL_sys_common.h" #include "HL_system.h" #include "HL_emac.h" #include "HL_hw_reg_access.h" // Global flag to track transmission status volatile uint8 txSuccessFlag = 0; uint8 src_emacAddress[6U] = {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU}; // TX MAC uint8 dest_emacAddress[6U] = {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU}; // RX MAC extern hdkif_t hdkif_data[1]; pbuf_t pack[1]; uint8 data[1][100]; uint8 a = 0; uint8 b = 0; uint8 c = 0; void create_packet() { int j; pack[0].tot_len = 64; // Make sure it's >= minimum Ethernet frame size pack[0].len = 64; // Destination MAC for (j = 0; j < 6; j++) data[0][j] = dest_emacAddress[j]; // Source MAC for (j = 0; j < 6; j++) data[0][j + 6] = src_emacAddress[j]; // EtherType data[0][12] = 0x88; data[0][13] = 0xB5; // Payload "hello" data[0][14] = 'h'; data[0][15] = 'e'; data[0][16] = 'l'; data[0][17] = 'l'; data[0][18] = 'o'; for (j = 19; j < 64; j++) data[0][j] = 0x00; pack[0].payload = &data[0][0]; pack[0].next = NULL; } // Notification function called when TX is complete void emacTxNotification(hdkif_t *hdkif) { // Set flag to indicate transmission success txSuccessFlag = 1; // Transmission completed successfully } void main(void) { _enable_IRQ(); EMACHWInit(src_emacAddress); create_packet(); while(1){ txSuccessFlag=0; if (EMACTransmit(&hdkif_data[0], &pack[0]) != 0) { // Transmission started, now wait for notification while (txSuccessFlag == 0); // Wait for notification (TX success) if (txSuccessFlag == 1) { // Transmission was successful a++; // Some logic to indicate success } else { // Transmission failed b = 9; // Some logic to indicate failure } } else { c = 9; } } }