Skip to content

Little update for lwIP_enc28j60#8376

Open
Nourbakhsh-Rad wants to merge 2 commits intoesp8266:masterfrom
Nourbakhsh-Rad:patch-2
Open

Little update for lwIP_enc28j60#8376
Nourbakhsh-Rad wants to merge 2 commits intoesp8266:masterfrom
Nourbakhsh-Rad:patch-2

Conversation

@Nourbakhsh-Rad
Copy link
Copy Markdown

A little update for lwIP_enc28j60 ...

Copy link
Copy Markdown
Collaborator

@d-a-v d-a-v left a comment

Choose a reason for hiding this comment

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

Beside the led API addition, some methods are aliased or duplicated.
Can you please enlighten us about your proposal ?


//--------------------------------------------------------
bool
ENC28J60::resetEther(void)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is it necessary ?

Copy link
Copy Markdown
Author

@Nourbakhsh-Rad Nourbakhsh-Rad Nov 17, 2021

Choose a reason for hiding this comment

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

Sometimes the ENC28J60 does not work properly (freezes) and needs to be reconfigured (please GOOGLE "enc28j60 freezes")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah you need to call it from "userland".
Instead of duping it, why don't you move it to the public section ?

}

uint8_t
ENC28J60::hardwareStatus(void)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it really hardwareStatus() or hardwareRevision/hardwareVersion() ?
We already have ::readrev() which seems to be identical.

Copy link
Copy Markdown
Author

@Nourbakhsh-Rad Nourbakhsh-Rad Nov 17, 2021

Choose a reason for hiding this comment

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

  • This function is similar to readrev function (it is private)
  • If this function returns 0xFF, that means "Hardware Error" (incorrect hardware revision)

(The EREVID register is commonly used to ensure the health of the hardware)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This function can be changed this way

uint8_t
ENC28J60::hardwareStatus(void)
{
	return readrev();		/* 0xFF = Hardware Error */
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Or it could be, as for reset(), moved to the public section without changing its name ?

Comment on lines +44 to +51
// PHLCON: PHY module LED control register
//
// R R R R L L L L L L L L R
// E E E E A A A A B B B B L L S E
// S S S S C C C C C C C C F F T S
// E E E E F F F F F F F F R R R E
// R R R R G G G G G G G G Q Q C R
// V V V V 3 2 1 0 3 2 1 0 1 0 H V
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can this table receive more comments on what it is for ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is LED control register that described in the ENC28J60 document (page 11) and used with LEDsConfig function

usage:
LEDsConfig(LED_LINK_STATUS, LED_TRANS_RECV); // LEDA, LEDB
LEDsConfig(LED_BLINK_SLOW, LED_NO_CHANGE); // LEDA, LEDB

http://ww1.microchip.com/downloads/en/devicedoc/39662a.pdf

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you plan to add this informations as source-code comments in your proposal ?

// wait until the PHY read completes
while(readreg(MISTAT) & 0x01){
delay(10);
wdt_reset();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMHO, delay() takes care of resetting the watchdog.

// wait until the PHY write completes
while(readreg(MISTAT) & 0x01){
delay(10);
wdt_reset();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

delay implies a WDT reset.

@dok-net
Copy link
Copy Markdown
Contributor

dok-net commented Nov 18, 2021

Please, while you are updating this lib, could you check about the fate of

src/utility/enc28j60.h: void clock_delay_usec(uint16_t dt);

I don't see any definition of the function anywhere.

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