Part Number: AM3358
Hi everyone,
I'm testing some non-standard ethernet communication and I want to send and receive data directly from the interface using only the internet protocol (MAC address based).
For that I want to use the CSPW driver directly (without lwIP). Here ( http://processors.wiki.ti.com/index.php/StarterWare_CPSW ) I found the programming sequence, but it's not clear how to send or receive a packet. I tried without success sending from this code based on lwIP ports:
#include "soc_AM335x.h"
#include "beaglebone.h"
#include "gpio_v2.h"
#include "cpsw.h"
#include "mdio.h"
#include "phy.h"
#include "consoleUtils.h"
#include "interrupt.h"
#include "cache.h"
#include "mmu.h"
#define MDIO_FREQ_INPUT 125000000
#define MDIO_FREQ_OUTPUT 1000000
int main()
{
volatile struct cpdma_tx_bd bd_to_send;
char buf[14] = {0x24, 0xbe, 0x05, 0x17, 0xbc, 0x4d, 0xb0, 0xd5, 0xcc, 0xad, 0x15, 0xfd, 0x08, 0x00}; // dest MAC, src MAC, 0x0800
MMUConfigAndEnable();
CPSWPinMuxSetup();
CPSWSSReset(SOC_CPSW_SS_REGS);
CPSWCPDMAReset(SOC_CPSW_CPDMA_REGS);
CPSWWrReset(SOC_CPSW_WR_REGS);
CPSWClkEnable();
MDIOInit(SOC_CPSW_MDIO_REGS, MDIO_FREQ_INPUT, MDIO_FREQ_OUTPUT);
CPSWSlReset(SOC_CPSW_SLIVER_1_REGS);
CPSWCPDMAEndOfIntVectorWrite(SOC_CPSW_CPDMA_REGS, CPSW_EOI_TX_PULSE);
CPSWCPDMAEndOfIntVectorWrite(SOC_CPSW_CPDMA_REGS, CPSW_EOI_RX_PULSE);
CPSWCPDMATxEnable(SOC_CPSW_CPDMA_REGS);
CPSWCPDMARxEnable(SOC_CPSW_CPDMA_REGS);
CPSWCPDMATxIntEnable(SOC_CPSW_CPDMA_REGS, 0);
CPSWWrCoreIntEnable(SOC_CPSW_WR_REGS, 0, 0, CPSW_CORE_INT_TX_PULSE);
CPSWCPDMARxIntEnable(SOC_CPSW_CPDMA_REGS, 0);
CPSWWrCoreIntEnable(SOC_CPSW_CPDMA_REGS, 0, 0, CPSW_CORE_INT_RX_PULSE);
CPSWSlRGMIIEnable(SOC_CPSW_SLIVER_1_REGS);
#define CPDMA_BUF_DESC_SOP 0x80000000
bd_to_send.next = NULL;
bd_to_send.bufptr = buf;
bd_to_send.bufoff_len = 14;
bd_to_send.flags_pktlen = 14;
bd_to_send.flags_pktlen |= CPDMA_BUF_DESC_SOP;
CPSWCPDMATxHdrDescPtrWrite(SOC_CPSW_CPDMA_REGS, (unsigned long)(&bd_to_send), 0); // Should this function send the data?
while(1);
}