Hi,
how can I read from FEC Receive FIFO Data Register (FECRFDR) without using DMA. Everytime I try to access this FIFO I get RFERR and my FEC stops. My DMA code (better the RTEMS code) crashes after a view minutes. So i will try to write a simple and stable polling driver.
I'm using a costum MCF5475 board.
What errors (if any) are you getting in FECRFSR to cause the RFERR? Are you allowing all these errors in FECRFCR?
Can you monitor FECRFRP and FECRFWP to see what's going wrong?
Whu can't you debug the "DMA Crash" and fix it?
Tom
Hi,
now I get Data, thx so far. The thing is I didn't get the data I send from my client and I'm pretty sure that I misunderstand the manuel.
I just want print raw data, which I receive from the FEC. I use this code:
while(1){ while( !(MCF548X_FEC_FECRFSR(ch) & MCF548X_FEC_FECRFSR_EMT) ){ int bla = MCF548X_FEC_FECRFDR(ch); printk("\n%08x", bla); char f1 = ((char *)&bla)[0]; char f2 = ((char *)&bla)[1]; char f3 = ((char *)&bla)[2]; char f4 = ((char *)&bla)[3]; printk("\n%c,%c,%c,%c", f1, f2, f3, f4); }}
And my FIFOS has this values.
EIR 08000000EIMR 003E0000ECR F0000002RCR 05EE0024R_HASH EF000000TCR 00000004FECTFWR 00000000FECRFSR 00080000FECRFCR 0F000000FECRLRFP 00000198FECRLWFP 000001DCFECRFAR 00000100FECRFRP 000001A8FECRFWP 000001DCFECTFSR 00030000FECTFCR 0F200000FECTLRFP 0000002EFECTLWFP 0000002EFECTFAR 00000100FECTFRP 0000002EFECTFWP 0000002EFRST 01000000
> Whu can't you debug the "DMA Crash" and fix it?
I will, but I'm new in this Project and I try to find the crash with a simple example. The crash happens between a view Minutes and an Hour, so its not that easy to find. The code seems correct so far.
I wrote:
> Are you allowing all these errors in FECRFCR?
> FECRFCR 0F000000
According to the manual, bit 0x00040000 is "reserved" and should be set in that register.
To enable all error reporting, you should try running with FECRFCR = 0x0FFC0000, and then see what shows up in FECRFSR.
In your loop reading the FIFO you should look for any "unexpected bits" in FECRFSR each time through the loop and print them when you find them to help with diagnosing what is goig wrong and when in your code path.
I assume you're sending the Ethernet packets from a PC? Possibly inside a UDP packet?
The "raw data" from the FEC will include the 12-byte Ethernet header, the 20 byte IP header and the 8 byte UDP header before you start seeing your "user data".
Do you know that the PPC is big-endian, and thus the data you're printing will have both the "int" and "char" values four-byte-swapped? Whatever you're printing that data to might go somewhat crazy with all the control codes you'll be printing during the headers. You might want to add some "isprint()" stuff in there, and possibly reverse the character printing order to "f4, f3, f2, f1".
Tom