Is it possible run MicroPython on RTL8720DN(BW16)?

Or plan to do that?
RTL8720DN have enough hardware resource to run MicroPython.

1 Like

Thanks for your interest, we would also like to run MicroPython on RTL8720DN, but currently it does not have enough RAM to run MicroPython(or lacks of memory optimazation), thus MicroPython is currently only supported on RTL8722DM which has 4MB PSRAM to spare.

If you are interested, you can take a look at the Github hub repo and try to optimize it for RTL8720DN

1 Like

How much RAM is available on this device?

Same as RTL8722DM, 512K RAM, but only around 456K is available for user

Oh, that ought to be plenty, though it makes perfect sense to make it a lower priority to the RTL8722DM.

Yeah, RTL8722DM has 4MB PSRAM, so some of the MicroPython memory are using PSRAM.

But I am also quite interested in how to lower the RAM requirement from MicroPython? besides disabling REPL and RF feature?

Hi @water-35 and @mattyt

I have managed to shift all memory to SRAM and get MicroPython working on BW16 aka RTL8720DN, will let you know once I push it to the github

cheers~

:slight_smile:

1 Like

Did you manage to build a firmware? I am considering using the RTL8720DN because I am very tired of fighting routers due to the lack of 5Ghz support but I am very much used to micropython.

Yes, and no.

Good news is, MicroPython Ameba port now works flawlessly with BW16 on WiFi related functions, GPIO too.

However, it’s missing pin definitions for other peripherals such as I2C and SPI etc.

you can build the firmware from here

Hello xi!
Thank you for your replies.
Do you have any plans to add those pin definitions in the near future? It would be really nice to end up with full support.
Also, any way to build this on windows? Or maybe you could be so nice as to provide an already compiled .bin? I have never built one of those firmware.

Also I know I am asking for a lot, but I currently flash things using esptool and I assume this won’t be possible, can you point me toward the direction of where I can learn to flash this firmware?
Thanks.

Hi @Fedack

Thanks for your interest, here are to your questions,

Yes, it will be added soon~ You can either build the firmware yourself or download the pre-built binary in the future

Yes, currenly building firmware is supported on Windows, Linux and MacOS

Yes, here is the link, simply download the Firmware and DownloadTool.zip file from the latest release,

The tool is included in the same zip file as mentioned in the above answer.

Thanks a lot, this answers my questions!
Do you have an eta on how soon that might be for the pin definitions?

Wonderful work you’re doing :slight_smile:

1 Like

we are working towards merging the Ameba MicroPython port into the MicroPython official repository, right now it’s pending code reviews, once this part is done, we will have more resource to add full features for BW16/RTL8720DN :slight_smile:

I try to build ‘RTL8722DM / RTL8722DM_MINI’ via:

micropython/ports/ameba> make

occur error: region `BD_RAM_NS’ overflowed by 224 bytes

==========================================================================
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
This build now supports Cygwin, Linux and MacOS
Please specify which board you are building for, currently supported boards:

  • RTL8722DM
  • RTL8722DM_MINI

Now building for: RTL8722DM_MINI
…/…/py/mkrules.mk:190: warning: overriding recipe for target ‘submodules’
Makefile:423: warning: ignoring old recipe for target ‘submodules’

/home/mc3/bin/gcc-arm-none-eabi-10.3-2021.10/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld: build/application.axf section .ram_heap.data' will not fit in region BD_RAM_NS’
/home/mc3/bin/gcc-arm-none-eabi-10.3-2021.10/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld: region `BD_RAM_NS’ overflowed by 224 bytes
Memory region Used Size Region Size %age Used
IROM: 0 GB 40 KB 0.00%
IROM_NS: 0 GB 216 KB 0.00%
DROM_NS: 0 GB 80 KB 0.00%
DROM: 0 GB 16 KB 0.00%
ROMBSS_RAM_COM: 0 GB 4 KB 0.00%
ROMBSS_RAM_NS: 0 GB 4 KB 0.00%
RSVD_RAM_NS: 0 GB 8 KB 0.00%
MSP_RAM_NS: 0 GB 4 KB 0.00%
BD_RAM_NS: 487648 B 476 KB 100.05%
ROMBSS_RAM_S: 0 GB 4 KB 0.00%
BOOTLOADER_RAM_S: 0 GB 8 KB 0.00%
MSP_RAM_S: 0 GB 4 KB 0.00%
EXTENTION_SRAM: 0 GB 128 KB 0.00%
PSRAM_NS: 0 GB 4194272 B 0.00%
KM0_BOOT: 0 GB 8160 B 0.00%
BACKUP: 0 GB 4 KB 0.00%
XIPSYS: 0 GB 4 KB 0.00%
KM4_BOOT: 0 GB 8160 B 0.00%
KM0_IMG2: 0 GB 33554400 B 0.00%
KM4_IMG2: 709080 B 33554400 B 2.11%
BTRACE: 0 GB 4 MB 0.00%
KM0_SRAM: 0 GB 64 KB 0.00%
RETENTION_RAM: 0 GB 1 KB 0.00%
collect2: error: ld returned 1 exit status
make: *** [Makefile:323: application] Error 1

How to configure to build a RTL8720DN/BW16 firmware?

Hi , you can edit the default MicroPython heap size in the main.c file under the above mentioned path, simply decrease the heap size by 1-2 KB and you should be able to finish compilation and build a working firmware

Hi, configuration for BW16 is still ongoing as the Ameba port is currently undergone major code re-factoring to simplify the building and editting process, you can expect an update containing all BW16 configuration in the coming 1 week or 2

Thanks for trying MicroPython ameba port and stay tuned for the updates~

meanwhile, the compiled firmware is already partially working on BW16 on selected modules, such as GPIO and WiFi, you can try them out if you like

“heap size” seems should be modify “MP_HEAP_SIZE” in “micropython/ports/ameba/mpconfigport.h”? right?

1 Like

Yes, you are right~