Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Commit

Permalink
Added SoftwareReset on init of chip to force default configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
0neblock committed Feb 7, 2017
1 parent 3e436cc commit 2e748fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utility/w5500.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void W5500Class::init(uint8_t ss_pin)
delay(1000);
initSS();
SPI.begin();

w5500.swReset();
for (int i=0; i<MAX_SOCK_NUM; i++) {
uint8_t cntl_byte = (0x0C + (i<<5));
write( 0x1E, cntl_byte, 2); //0x1E - Sn_RXBUF_SIZE
Expand Down
6 changes: 6 additions & 0 deletions src/utility/w5500.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class W5500Class {
inline void setRetransmissionTime(uint16_t timeout);
inline void setRetransmissionCount(uint8_t _retry);

inline void swReset();

inline void setPHYCFGR(uint8_t _val);
inline uint8_t getPHYCFGR();

Expand Down Expand Up @@ -411,4 +413,8 @@ uint8_t W5500Class::getPHYCFGR() {
return read(0x002E, 0x00);
}

void W5500Class::swReset() {
writeMR( (readMR() | 0x80) );
}

#endif

0 comments on commit 2e748fd

Please sign in to comment.