Git Product home page Git Product logo

wiznetinterface's Introduction

WIZnetInterface Library

Examples

Program setting for using WiznetInterface in mbed_app.json.

  • Define SPI interface pin.
  • Define Reset Pin for module reset.
{
    "name": "WIZNET",
    "config": {
        "sck": {
            "help": "sck pin for spi connection. defaults to SPI_SCK",
            "value": "SPI_SCK"
        },
        "cs": {
            "help": "cs pin for spi connection. defaults to SPI_CS",
            "value": "SPI_CS"
        },
        "miso": {
            "help": "miso pin for spi connection. defaults to SPI_MISO",
            "value": "SPI_MISO"
        },
        "mosi": {
            "help": "mosi pin for spi connection. defaults to SPI_MOSI",
            "value": "SPI_MOSI"
        },
        "rst": {
            "help": "RESET pin for spi connection. defaults to D15",
            "value": "D15"
        },
        "debug": {
            "help": "Enable debug logs. [true/false]",
            "value": true
        },
        "provide-default": {
            "help": "Provide default WifiInterface. [true/false]",
            "value": false
        },
        "socket-bufsize": {
            "help": "Max socket data heap usage",
            "value": 8192
        }
    },
    "target_overrides": {
    }
}

wiznetinterface's People

Contributors

bjnhur avatar strange-v avatar teddywiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wiznetinterface's Issues

Mbed 5.15.4 build problem

PLATFORM: ST STM32 (8.1.0) > STM32F103C8 (20k RAM. 64k Flash)
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES:

  • framework-mbed 6.51504.200716 (5.15.4)
  • toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)

we use WIZnetInterface github last version on main.c

`#include "mbed.h"
//#include "MQTTClient.h"
#include "WIZnetInterface.h"

//NetworkInterface *net;

int main()
{

while (true)
{

}

}`

we got some error from WIZnetInterface . it seem TCPSocket api version change. how can we fix it?

debug output
.pio\libdeps\genericSTM32F103C8\WIZnetInterface\TESTS\net\tcp_echo\main.cpp:60:24: warning: 'TCPSocket::TCPSocket(S*) [with S = WIZnetInterface]' is deprecated: The TCPSocket(S *stack) constructor is deprecated.It discards the open() call return value.Use another constructor and call open() explicitly, instead. [since mbed-os-5.11] [-Wdeprecated-declarations]
60 | TCPSocket sock(&net);
| ^
In file included from D:/PROJECT/PlatformIO/PlatformIO_Home/packages/framework-mbed/features/netsocket/nsapi.h:41,
from D:/PROJECT/PlatformIO/platformio_home/packages/framework-mbed/mbed.h:26,
from .pio\libdeps\genericSTM32F103C8\WIZnetInterface\TESTS\net\tcp_echo\main.cpp:1:
D:/PROJECT/PlatformIO/PlatformIO_Home/packages/framework-mbed/features/netsocket/TCPSocket.h:54:5: note: declared here
54 | TCPSocket(S *stack)
| ^~~~~~~~~
In file included from .pio/libdeps/genericSTM32F103C8/WIZnetInterface/WIZnet/wiznet.h:15,
from .pio\libdeps\genericSTM32F103C8\WIZnetInterface\TESTS\net\connectivity../../../WIZnetInterface.h:24,
from .pio\libdeps\genericSTM32F103C8\WIZnetInterface\TESTS\net\connectivity\main.cpp:6:
.pio/libdeps/genericSTM32F103C8/WIZnetInterface/WIZnet/W5500.h:12: warning: "TEST_ASSERT" redefined
12 | #define TEST_ASSERT(A) while(!(A)){debug("\n\n%s@%d %s ASSERT!\n\n",PRETTY_FUNCTION,LINE,#A);exit(1);};
|
In file included from .pio\libdeps\genericSTM32F103C8\WIZnetInterface\TESTS\net\connectivity\main.cpp:3:
D:/PROJECT/PlatformIO/PlatformIO_Home/packages/framework-mbed/features/frameworks/unity/unity/unity.h:92: note: this is the location of the previous definition
92 | #define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), LINE, " Expression Evaluated To FALSE")
|
*** [.pio\build\genericSTM32F103C8\lib2ea\WIZnetInterface\TESTS\net\tcp_echo\main.o] Error 1

wait_readable returns 0 instead of NSAPI_ERROR_WOULD_BLOCK

According to the Mbed documentation socket.recv method should return NSAPI_ERROR_WOULD_BLOCK in case it non-blocking or timeout.

But if we check the code we can see that it returns size in case of timeout (zero in many cases).

        if ((size1 > req_size) || (wait_time_ms != (-1) && t.read_ms() > wait_time_ms)) 
        {
            return size1;
        }
    }
    return NSAPI_ERROR_WOULD_BLOCK;

It seems incorrect. Am I wrong?

Garbage when send (probably when receive too) with data packet > 2048

There is a bug in wiznetinterface.cpp. Change code in WIZnetInterface::socket_send line 574 (Tested in nucleo l476RG)
ret = _wiznet.send(SKT(handle)->fd, (char*)((uint32_t )data+writtenLen) , (int)_size);
with
ret = _wiznet.send(SKT(handle)->fd, (char
)((uint32_t *)data)+writtenLen, (int)_size);

and probably too in WIZnetInterface::socket_recv line 687 (this is not tested)
retsize = _wiznet.recv(SKT(handle)->fd, (char*)((uint32_t )data + recved_size), (int)_size);
with
retsize = _wiznet.recv(SKT(handle)->fd, (char
)((uint32_t *)data) + recved_size, (int)_size);
Best regards

W5500 does not work when the reset pin is connected

I have two different modules with the W5500 chip and both of them behave identically. They work correctly only when the reset pin is disconnected or reset functionality is commented out (last four lines in the code below):

// Reset the chip & set the buffer
void WIZnet_Chip::reset()
{
//    reset_pin = 1;
    reset_pin = 0;
    wait_us(500); // 500us (w5500)
    reset_pin = 1;
    wait_ms(400); // 400ms (w5500)

This behavior is strange because the reset functionality looks correct.

Mbed OS 5.14.2
STM32F411CEU6 (blue pill)
Please let me know if some additional information will be helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.