Page 2 of 3

Re: no <sys/stat.h> and <sys/types.h>

Posted: Sun Jul 28, 2013 5:39 pm
by Giovanni
Is the board IP in your same subnet?

Giovanni

Re: no <sys/stat.h> and <sys/types.h>

Posted: Sun Jul 28, 2013 5:55 pm
by delphi
Yes.

Re: no <sys/stat.h> and <sys/types.h>

Posted: Mon Jul 29, 2013 1:16 pm
by delphi
Following is the ip settings of my lwipthread.h

Code: Select all

/** @brief IP Address. */
#if !defined(LWIP_IPADDR) || defined(__DOXYGEN__)
#define LWIP_IPADDR(p)                      IP4_ADDR(p, 192, 168, 8, 20)
#endif

/** @brief IP Gateway. */
#if !defined(LWIP_GATEWAY) || defined(__DOXYGEN__)
#define LWIP_GATEWAY(p)                     IP4_ADDR(p, 192, 168, 8, 1)
#endif

/** @brief IP netmask. */
#if !defined(LWIP_NETMASK) || defined(__DOXYGEN__)
#define LWIP_NETMASK(p)                     IP4_ADDR(p, 255, 255, 255, 0)
#endif


Here is my computer's config
Here is my computer's config
62238D6C-6445-4C7D-B3A9-6F207FD889D6.png (13.8 KiB) Viewed 7265 times

Re: no <sys/stat.h> and <sys/types.h>

Posted: Mon Jul 29, 2013 1:19 pm
by Giovanni
Hi,

I would double check the settings of I/O pins and PHY-related clocks. The lwIP demos are working on several boards I have, the problem must be specific of your setup.

Giovanni

Re: no <sys/stat.h> and <sys/types.h>

Posted: Mon Jul 29, 2013 1:40 pm
by delphi
Ok, I will try to read/write frames without lwIP. At the other side, I havn't setup any clocks of PHY. Which file contains the code of PHY clocks setup.
Delphi

Re: no <sys/stat.h> and <sys/types.h>

Posted: Mon Jul 29, 2013 7:34 pm
by delphi
My phy board is from waveshare. The pins it provided should be MII. But i read some post say MII is using 25MHz crystal buy my board come with a 50MHz crystal. Should I configure it to RMII? Sorry that I know not much about MII and RMII.
Delphi

Re: no <sys/stat.h> and <sys/types.h>

Posted: Mon Jul 29, 2013 7:49 pm
by Giovanni
Can't help, you should be able to understand that from the PHY board schematic and how it is connected to the Discovery, BTW, keep wires *very* short.

Why don't you get one of the supported boards? this one for example: https://www.olimex.com/Products/ARM/ST/ ... e-hardware

Giovanni

Re: no <sys/stat.h> and <sys/types.h>

Posted: Tue Jul 30, 2013 9:06 am
by delphi
Yea, I checked with the schematic of my PHY board and read some articles about MII and RMII. I am pretty sure RMII needs to be used for my PHY board and double checked the wire connections.
Then i try to read the raw incoming frame data from MAC. Can you tell if the following code can do so? If no, what is the proper way to read raw incoming frame from MAC.
Thanks.

Delphi

Code: Select all

static WORKING_AREA(waTH21,128);

static msg_t thFunc_MAC(void *arg)
{
MACConfig MACConf;
static uint8_t MAC_addr[6];
msg_t msg;
MACReceiveDescriptor rdp;
size_t len;
uint8_t buf[1500];

MAC_addr[0] = 0xAA;
MAC_addr[1] = 0x55;
MAC_addr[2] = 0x13;
MAC_addr[3] = 0x37;
MAC_addr[4] = 0x01;
MAC_addr[5] = 0x10;
MACConf.mac_address = MAC_addr;
macStart (&ETHD1, &MACConf);
while(true)
{
if(macPollLinkStatus (&ETHD1))
palSetPad(GPIOD, GPIOD_LED6);
else
palClearPad(GPIOD, GPIOD_LED6);
msg=macWaitReceiveDescriptor  (&ETHD1, &rdp,TIME_IMMEDIATE );
if(msg==RDY_OK)
{
len=mac_lld_read_receive_descriptor(&rdp,buf,1500);
sdWrite(&SD3, buf, len);
macReleaseReceiveDescriptor   (&rdp);
}
}
}

Re: no <sys/stat.h> and <sys/types.h>

Posted: Tue Jul 30, 2013 9:25 am
by Giovanni
It looks OK except you use a LLD function, you should use the high level equivalent.

Giovanni

Re: no <sys/stat.h> and <sys/types.h>

Posted: Tue Jul 30, 2013 11:14 am
by delphi
cool , I can read the ARP request from my computer when i am pinging the board now. I can sure the clock and the RX part of RMII is no problem now. I will then try to write raw frames to MAC by following codes.

Code: Select all

MACTransmitDescriptor tdp;
msg=macWaitTransmitDescriptor   (&ETHD1, &tdp,TIME_IMMEDIATE );
len= macWriteTransmitDescriptor   (&tdp,buf,len);   


Do I need to release the Transmitt Descriptor after i wrote it?

Delphi