8000 stm32: Add support for PYBD boards by dpgeorge · Pull Request #4669 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

stm32: Add support for PYBD boards #4669

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

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ec93e58
drivers/memory: Add mp_spiflash_deepsleep() function.
dpgeorge Apr 3, 2019
870f0a7
extmod/modlwip: Use mp_sched_schedule to schedule socket callback.
dpgeorge Apr 3, 2019
1f931f1
extmod/modlwip: Minor improvements to TCP send behaviour.
dpgeorge Apr 3, 2019
1fb1be0
lib/netutils: Add DHCP server component.
dpgeorge Apr 3, 2019
cfa4e3c
lib: Add new submodule for mbedtls, currently v2.16.0.
dpgeorge Apr 3, 2019
2dc84c9
stm32: Integrate mbedtls for ussl module.
dpgeorge Apr 3, 2019
6ce52f7
stm32/lwip_inc: Update lwIP config and enable mDNS.
dpgeorge Apr 3, 2019
93b2e83
stm32/qspi: Use MPU to prevent access to invalid SPI flash memory region
dpgeorge Apr 3, 2019
7921158
stm32: Enable lwIP mDNS responder.
dpgeorge Apr 3, 2019
8e36c86
stm32/modpyb: Add pyb.country() function to set the country.
dpgeorge Apr 3, 2019
4ae7832
stm32/extint: Add extint_set() function for internal C access to EXTI.
dpgeorge Apr 3, 2019
a83491d
stm32/mphalport: Add support for having MAC in OTP region.
dpgeorge Apr 3, 2019
523d56a
.gitattributes: Make *.a be binary files.
dpgeorge Apr 3, 2019
086e8c0
stm32: Add driver for CYW43xx WiFi chips.
dpgeorge Apr 3, 2019
d8e90f7
stm32: Add low-level SDIO interface for cyw43 driver.
dpgeorge Apr 3, 2019
ce85c97
stm32: Add network.WLAN class for cyw43 driver.
dpgeorge Apr 3, 2019
76eff13
stm32: Integrate in the cyw43 driver and network.WLAN class.
dpgeorge Apr 3, 2019
b5ab74e
stm32/mpconfigport.h: Enable modules useful for networking.
dpgeorge Apr 3, 2019
6100c95
stm32/powerctrl: Wake and sleep external QSPI flash in MCU stop mode.
dpgeorge Apr 3, 2019
f2a1c22
stm32/usb: Update USB interface to support msc and port keyword args.
dpgeorge Apr 3, 2019
87a9e99
stm32/modules: Add various modules useful for networking.
dpgeorge Apr 3, 2019
0cc6421
stm32/boards/make-pins.py: Allow a pin to only have a cpu name.
dpgeorge Apr 3, 2019
be49c0f
stm32/modmachine: Enable machine.RTC() class, so ntptime works.
dpgeorge Apr 3, 2019
4417c03
stm32/boards: Add board definition files for PYBD -SF2, -SF3, -SF6.
dpgeorge Apr 3, 2019
bae3179
stm32/boards: Remove USB_VBUS and USB_ID from PYBD pin list.
dpgeorge Apr 6, 2019
a209236
stm32/cyw43: For sta.config('essid') return SSID of network it's on.
dpgeorge Apr 8, 2019
7bc7a5a
stm32/cyw43: Add support for setting auth when connecting.
dpgeorge Apr 11, 2019
297acc9
stm32/network_cyw43: Update to pass through auth setting in connect.
dpgeorge Apr 11, 2019
87b2be9
stm32/boards/PYBD: Enable MICROPY_HW_RTC_USE_BYPASS.
dpgeorge Apr 11, 2019
caa425b
Merge branch 'master' into stm32-pybd
dpgeorge Apr 11, 2019
60b1acc
stm32/qspi: Abort any transfers if peripheral is busy.
dpgeorge Apr 11, 2019
1dcea07
stm32/powerctrl: Fix up ordering and config of QSPI deepsleep.
dpgeorge Apr 11, 2019
1e5bea3
stm32/cyw43: Update to improve connection at edge of cell.
dpgeorge Apr 11, 2019
e8f4a6b
Merge branch 'master' into stm32-pybd
dpgeorge Apr 12, 2019
3e3dd81
py/py.mk: Move mdns source from stm32 Makefile to global py.mk.
dpgeorge Apr 12, 2019
4c9b88e
lib/netutils/dhcpserver: Guard by MICROPY_PY_LWIP.
dpgeorge Apr 12, 2019
eeb6477
stm32/network_cyw43: Move CYW43 config guard above lwip includes.
dpgeorge Apr 12, 2019
4fdc731
stm32/powerctrl: Guard SPI flash calls with QSPI config macro.
dpgeorge Apr 12, 2019
d1444f5
Merge branch 'master' into stm32-pybd
dpgeorge Apr 18, 2019
5909369
stm32/cyw43: Update to fix async event handling during deinit.
dpgeorge Apr 25, 2019
2bf3c24
Merge branch 'master' into stm32-pybd
dpgeorge Apr 29, 2019
bf9bcc1
lib/netutils/dhcpserver: Add dhcp_server_deinit() function to free mem.
dpgeorge Apr 30, 2019
a13e586
stm32/cyw43: Free all lwIP memory when doing deinit() of WLAN.
dpgeorge Apr 30, 2019
a3d4ca6
Merge branch 'master' into stm32-pybd
dpgeorge May 22, 2019
533a2e1
stm32/factoryreset: Add pyb.country to initial boot.py file.
dpgeorge May 22, 2019
d28ef85
stm32/boards/PYBD_SF6: Add UART7 definition.
dpgeorge May 22, 2019
2b05d88
Merge branch 'master' into stm32-pybd
dpgeorge May 24, 2019
a9b1d3c
Merge branch 'master' into stm32-pybd
dpgeorge May 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.bat text eol=crlf

# These are binary so should never be modified by git.
*.a binary
*.png binary
*.jpg binary
*.dxf binary
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
[submodule "lib/nrfx"]
path = lib/nrfx
url = https://github.com/NordicSemiconductor/nrfx.git
[submodule "lib/mbedtls"]
path = lib/mbedtls
url = https://github.com/ARMmbed/mbedtls.git
10 changes: 10 additions & 0 deletions drivers/memory/spiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ void mp_spiflash_init(mp_spiflash_t *self) {

mp_spiflash_acquire_bus(self);

mp_spiflash_deepsleep(self, 0);

#if defined(CHECK_DEVID)
// Validate device id
uint32_t devid = mp_spiflash_read_cmd(self, CMD_RD_DEVID, 3);
Expand Down Expand Up @@ -482,3 +484,11 @@ int mp_spiflash_cached_write(mp_spiflash_t *self, uint32_t addr, size_t len, con
mp_spiflash_release_bus(self);
return 0;
}

void mp_spiflash_deepsleep(mp_spiflash_t *self, int value) {
if (value) {
mp_spiflash_write_cmd(self, 0xb9); // sleep
} else {
mp_spiflash_write_cmd(self, 0xab); // wake
}
}
2 changes: 2 additions & 0 deletions drivers/memory/spiflash.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ void mp_spiflash_cache_flush(mp_spiflash_t *self);
void mp_spiflash_cached_read(mp_spiflash_t *self, uint32_t addr, size_t len, uint8_t *dest);
int mp_spiflash_cached_write(mp_spiflash_t *self, uint32_t addr, size_t len, const uint8_t *src);

void mp_spiflash_deepsleep(mp_spiflash_t *self, int value);

#endif // MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H
22 changes: 19 additions & 3 deletions extmod/modlwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ STATIC void lwip_socket_free_incoming(lwip_socket_obj_t *socket) {

static inline void exec_user_callback(lwip_socket_obj_t *socket) {
if (socket->callback != MP_OBJ_NULL) {
mp_call_function_1_protected(socket->callback, MP_OBJ_FROM_PTR(socket));
mp_sched_schedule(socket->callback, MP_OBJ_FROM_PTR(socket));
}
}

Expand Down Expand Up @@ -637,22 +637,29 @@ STATIC mp_uint_t lwip_tcp_send(lwip_socket_obj_t *socket, const byte *buf, mp_ui

u16_t available = tcp_sndbuf(socket->pcb.tcp);

if (available == 0) {
if (available == 0 || tcp_sndqueuelen(socket->pcb.tcp) >= TCP_SND_QUEUELEN) {
// Non-blocking socket
if (socket->timeout == 0) {
MICROPY_PY_LWIP_EXIT
*_errno = MP_EAGAIN;
return MP_STREAM_ERROR;
}

err_t err = tcp_output(socket->pcb.tcp);
if (err != ERR_OK) {
MICROPY_PY_LWIP_EXIT
*_errno = error_lookup_table[-err];
return MP_STREAM_ERROR;
}

mp_uint_t start = mp_hal_ticks_ms();
// Assume that STATE_PEER_CLOSED may mean half-closed connection, where peer closed it
// sending direction, but not receiving. Consequently, check for both STATE_CONNECTED
// and STATE_PEER_CLOSED as normal conditions and still waiting for buffers to be sent.
// If peer fully closed socket, we would have socket->state set to ERR_RST (connection
// reset) by error callback.
// Avoid sending too small packets, so wait until at least 16 bytes available
while (socket->state >= STATE_CONNECTED && (available = tcp_sndbuf(socket->pcb.tcp)) < 16) {
while (socket->state >= STATE_CONNECTED && ((available = tcp_sndbuf(socket->pcb.tcp)) < 16 || tcp_sndqueuelen(socket->pcb.tcp) >= TCP_SND_QUEUELEN)) {
MICROPY_PY_LWIP_EXIT
if (socket->timeout != -1 && mp_hal_ticks_ms() - start > socket->timeout) {
*_errno = MP_ETIMEDOUT;
Expand All @@ -669,6 +676,15 @@ STATIC mp_uint_t lwip_tcp_send(lwip_socket_obj_t *socket, const byte *buf, mp_ui
u16_t write_len = MIN(available, len);

err_t err = tcp_write(socket->pcb.tcp, buf, write_len, TCP_WRITE_FLAG_COPY);
if (err == ERR_MEM) {
for (int i = 0; i < 100 && err == ERR_MEM; ++i) {
err = tcp_output(socket->pcb.tcp);
MICROPY_PY_LWIP_EXIT
poll_sockets();
MICROPY_PY_LWIP_REENTER
err = tcp_write(socket->pcb.tcp, buf, write_len, TCP_WRITE_FLAG_COPY);
}
}

// If the output buffer is getting full then send the data to the lower layers
if (err == ERR_OK && tcp_sndbuf(socket->pcb.tcp) < TCP_SND_BUF / 4) {
Expand Down
1 change: 1 addition & 0 deletions lib/mbedtls
Submodule mbedtls added at fb1972
Loading
0