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

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

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

Post by Giovanni »

Is the board IP in your same subnet?

Giovanni
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

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

Post by delphi »

Yes.
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

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

Post 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 7257 times
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

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

Post 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
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

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

Post 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
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

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

Post 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
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

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

Post 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
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

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

Post 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);
}
}
}
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

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

Post by Giovanni »

It looks OK except you use a LLD function, you should use the high level equivalent.

Giovanni
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

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

Post 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
Post Reply