Skip to content

STM32Ethernet source files #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from Aug 16, 2017
Merged

STM32Ethernet source files #1

merged 11 commits into from Aug 16, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jul 4, 2017

STM32Ethernet source files for Ethernet library for STM32 cores and Arduino environment.

@fpistm fpistm self-requested a review July 5, 2017 13:47
@fpistm fpistm assigned fpistm and ghost and unassigned fpistm Jul 5, 2017
@fpistm fpistm requested a review from LMESTM July 5, 2017 13:48
Copy link
Member

@LMESTM LMESTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok - may be good to have some information inside the README.md as well.

README.md Outdated
## Ethernet Library for Arduino

With an STM32 board with Ethernet compatibility, this library allows an STM32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo: an STM32

README.md Outdated
The library is based on LwIP, a Lightweight TCP/IP stack.
http://git.savannah.gnu.org/cgit/lwip.git

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that LWIP has been ported as Arduino lib and this lib is dependent of this one

by Norbert Truchsess
modified 23 Jun 2017
by Wi6Labs

Copy link
Member

@fpistm fpistm Jul 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add dependency with LWIP lib from stm32duino (far all example)

author=Various
maintainer=STMicroelectronics
sentence=Enables network connection (local and Internet) using the STM32 Board.
paragraph=With this library you can use the STM32 board to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention LWIP stm23duino dependency

Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please; enable all compilers warning to ensure there is no one (at least for this lib)

src/Dns.cpp Outdated
uint16_t acc = 0; // Accumulator
uint8_t dots = 0;

while (*address)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if address is NULL

src/Dhcp.h Outdated
/* DHCP state machine. */
#define STATE_DHCP_STOP DHCP_OFF
#define STATE_DHCP_START DHCP_START
#define STATE_DHCP_DISCOVER DHCP_WAIT_ADDRESS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace tab by space

src/Dhcp.h Outdated
private:
uint8_t _dhcpMacAddr[6];
unsigned long _timeout;
uint8_t _dhcp_lease_state;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace tab by space

src/Dns.cpp Outdated

#include "Dns.h"
#include <string.h>
//#include <stdlib.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

src/Dns.cpp Outdated
{
UNUSED(aName);
// Success! Everything buffered okay
return 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please explain why always return 1 (deprecated?)

}

_tcp_client->pcb = NULL;
// _tcp_client->state = TCP_NONE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove

int EthernetClass::maintain(){
int rc = DHCP_CHECK_NONE;

// stm32_eth_scheduler();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove or add more comment

******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use generic include stm32_def.h

/* Configure the Network interface */
Netif_Config();

//TODO: juste temporaire pour debug: laisser à l'utilisateur la possibilité de l'utiliser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In English and explain more please

pbuf_free(p);
p = q;
return p;
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty else ? to remove

@danieleff
Copy link

src/utility/stm32_eth.h includes #include "stm32f4xx_hal.h"
Please include stm32_def.h instead

@ghost
Copy link
Author

ghost commented Jul 24, 2017

Thank you @danieleff .
Fix done.

src/Dhcp.h Outdated
#define DEFAULT_LEASE (900) //default lease time in seconds
#define STATE_DHCP_STOP DHCP_OFF
#define STATE_DHCP_START DHCP_START
#define STATE_DHCP_DISCOVER DHCP_WAIT_ADDRESS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indent

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED

#include <STM32Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this line

// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED

#include <EthernetUdp.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this line

#include <STM32Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this line

@fpistm fpistm merged commit 4c7d80e into stm32duino:master Aug 16, 2017
@nopnop2002 nopnop2002 mentioned this pull request Jul 24, 2019
ABOSTM pushed a commit to ABOSTM/STM32Ethernet that referenced this pull request Mar 1, 2022
…CP_fails

when DHCP fails the static IP can be appllied without problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants