{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/1517","labels_url":"https://api.github.com/repos/micropython/micropython/issues/1517/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/1517/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/1517/events","html_url":"https://github.com/micropython/micropython/pull/1517","id":111998510,"number":1517,"title":"extmod/modlwip: lwIP module for micropython","user":{"login":"galenhz","id":1783379,"avatar_url":"https://avatars.githubusercontent.com/u/1783379?v=3","gravatar_id":"","url":"https://api.github.com/users/galenhz","html_url":"https://github.com/galenhz","followers_url":"https://api.github.com/users/galenhz/followers","following_url":"https://api.github.com/users/galenhz/following{/other_user}","gists_url":"https://api.github.com/users/galenhz/gists{/gist_id}","starred_url":"https://api.github.com/users/galenhz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galenhz/subscriptions","organizations_url":"https://api.github.com/users/galenhz/orgs","repos_url":"https://api.github.com/users/galenhz/repos","events_url":"https://api.github.com/users/galenhz/events{/privacy}","received_events_url":"https://api.github.com/users/galenhz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-18T03:21:20Z","updated_at":"2015-10-18T07:17:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/micropython/micropython/pulls/1517","html_url":"https://github.com/micropython/micropython/pull/1517","diff_url":"https://github.com/micropython/micropython/pull/1517.diff","patch_url":"https://github.com/micropython/micropython/pull/1517.patch"},"body":"General lwIP module for micropython. Not perfect; probably needs adjustments for other ports, memory utilization, and other minor issues, but it does its job for straightforward cases, and future improvements should be simple.\r\n\r\nTo use, you'll need to configure a SLIP connection on your friendly linux box. I do it as follows, your mileage may vary.\r\n\r\n    slattach -L -p slip -s 115200 /dev/ttyUSB0 &\r\n    ifconfig sl0 192.168.5.1 pointopoint 192.168.5.2 mtu 1500\r\n\r\nRun the following code on the pyboard to enable it:\r\n\r\n    import lwip\r\n    import pyb\r\n    lwip.reset()\r\n    tim = pyb.Timer(7)\r\n    tim.init(freq=20)\r\n    tim.callback(lambda t:lwip.callback())\r\n\r\n    u = pyb.UART(2, 115200, read_buf_len=3100)\r\n    sl = lwip.slip(2, \"192.168.5.2\", \"192.168.5.1\")\r\n\r\nThis will get a SLIP connection going on serial port 2, with the board configured as 192.168.5.2 and the linux host as 192.168.5.1.\r\n\r\nThe lwip.socket module works more or less like you'd expect.\r\n\r\n    sock = lwip.socket(lwip.AF_INET, lwip.SOCK_STREAM)\r\n    sock.connect((\"192.168.5.1\", 22))\r\n    print(sock.recv(1024))\r\n    sock.close()\r\n\r\nThat code will print the protocol version string from your local ssh server.\r\n"},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/148986462","html_url":"https://github.com/micropython/micropython/pull/1517#issuecomment-148986462","issue_url":"https://api.github.com/repos/micropython/micropython/issues/1517","id":148986462,"user":{"login":"pfalcon","id":500451,"avatar_url":"https://avatars.githubusercontent.com/u/500451?v=3","gravatar_id":"","url":"https://api.github.com/users/pfalcon","html_url":"https://github.com/pfalcon","followers_url":"https://api.github.com/users/pfalcon/followers","following_url":"https://api.github.com/users/pfalcon/following{/other_user}","gists_url":"https://api.github.com/users/pfalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/pfalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfalcon/subscriptions","organizations_url":"https://api.github.com/users/pfalcon/orgs","repos_url":"https://api.github.com/users/pfalcon/repos","events_url":"https://api.github.com/users/pfalcon/events{/privacy}","received_events_url":"https://api.github.com/users/pfalcon/received_events","type":"User","site_admin":false},"created_at":"2015-10-18T07:17:53Z","updated_at":"2015-10-18T07:17:53Z","body":"Build instructions (after checking out lwip-prototype2 branch):\r\n\r\n~~~~\r\ngit submodule update --init\r\nmake MICROPY_PY_LWIP=1 MICROPY_PY_LWIP_SLIP=1\r\n~~~~\r\n\r\nI can confirm this builds for me.\r\n"}}