-
Notifications
You must be signed in to change notification settings - Fork 4
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
Compilation of w600 port IV #23
Comments
I don't know whether you are interested to take this up:
and restrict to
to free the relevant (now permanently occupied) RAM area. |
Sorry for the tardy reply. I just noticed that message. Yes, you had asked that before. Sine slave mode is not used by any other port, and HSPI seems to be used only for slave mode, it could be dropped. Looking into the SDK, there seems no options for HSPI master mode. Note that the file which you attached seems to be an old version. The actual machine_spi.c is way smaller after removing some code duplication. |
Scanning through the source files of the WM_SDK and the port, it seems that the HSPI/SDIO is using 8k of RAM. The note in wm_hspi.h which talks of 26k seems wrong. The addresses mentioned there are wrong as well. At the moment we have: 20037fff: Top of Python heap |
Yes. These are in #define MASTER_SPI_DMA_ADDR 0x20038000UL /*Master SPI use buffer when spi use dma transfer mode*/
#define SLAVE_HSPI_SDIO_ADDR 0x2003A000UL /*High speed SPI or SDIO buffer to exchange data*/
#define WIFI_MEM_START_ADDR 0x2003C000UL /*Wi-Fi use buffer to exchange data*/ So the 8k of HSPI can be saved and hopefully also the 8k DMA. I will now re-read our old conversation about RAM and perhaps re-post here. |
The rest is about the FreeRTOS tasks which you had optimized afterwards. Then we had the firmware update change. |
I try to understand my changes to
#if MICROPY_HSPI_SLAVE
#include "wm_hspi.h"
#endif if it is 0 then all aof wm_hspi.h is not included.
#if MICROPY_HSPI_SLAVE
uint8_t spi_type;/* 0-lspi, 1-hspi */
#endif and later switched out all the code for the hspi. |
The section if (-1 == self->bits) {
tls_spi_trans_type(SPI_DMA_TRANSFER);
} else {
if (8 == self->bits) {
tls_spi_trans_type(SPI_BYTE_TRANSFER);
} else if (32 == self->bits) {
tls_spi_trans_type(SPI_WORD_TRANSFER);
} else {
tls_spi_trans_type(SPI_DMA_TRANSFER);
}
} of |
No, we cannot exclude that. And we cannot exclude that people use the slave mode. Maybe the buffers could be dynamically allocated, or the reserved space could be reduced. |
That might indicate that the HSPI/SDIO functionality is never used, because, if it were, it would be in conflict with the others. What would one use for testing SPI reliably? Does an SDcard attached externally using sdcard.py suffice for that? At present we have (in which also could/should be reduced, of course. Also there is I thing this whole thing makes sense thinking of a later w800 compile, which should be quite identical. As all register definitions are the same and the SDK is literally a copy of the w600. With another processor and the addition of Bluetooth. |
I'm testing now SPI for SD card and for that read the MP Micropython user guide. There to my surprise I found:
On your MD page describing this port you only mention the latter 4 components. |
I tested the SPI with a 4GB SDCard. Using mendenms new driver and test. Driver and test files are here: Hardware SPI at 20MHz seems to work well. The test yielded:
Change to the higher SPI speed really yielded faster data transfer. For comparison mendenm reported
Given we have only 80MHz CPU and 20MHz SPI our values are quite o.k.. Now testing changes of SPI can begin. |
The file README.md is a mix of the initial version by Winner and my additions, which start in the section "Building the firmware". I do not think that alone setting Thank you for testing with the SD card. I had tried an SD card earlier and an external SPI chip as well and found both working. I made no speed test, but speed may not something to be expected with the W60x. |
Good morning Robert, I made changes to machine_spi.c similar to the changes in the last version of that file and compiled. So if you like to try that out... |
Confirmed that as it did not compile afterwards. Compiler errors lead me to apply the same changes I had done half a year ago. Now there is the |
With
|
I inserted The MP user manual tells:
Now the |
The general rule for MP SPI seems to be, the ID >= 0 is a hard SPI, and id=-1 is SoftSPI as legacy option, to be dropped in the future. The option -1 is not supported for the W60X port and not for other ports like RP2, STM32, MIMXRT, etc. 0: Use ordinary SPI. |
There is a line: |
I reverted to the complete build including HSPI and tested: With id=1 (HSPI) the SDCard test program hangs, which is expected given that only slave SPI is possible). So either we re-establish SoftSPI or leave the id out completely, as it has no function. |
With MP version 1.10 there was SoftSPI available. Using id=-1 it reported then as SoftSPI. |
May not be necessary, since all major ports dropped that option already. And no one complained so far. |
O.k., I was able to do a spi = SPI(-1, baudrate=400000, sck=Pin(Pin.PB_16), miso=Pin(Pin.PB_17), mosi=Pin(Pin.PB_18)) # for older w600 versions
spi.init() # Ensure right baudrate
sd = sdcard.SDCard(spi, Pin(Pin.PB_15)) and the SD card was correctly reported as v1 or v2 with MP 1.10 (e.g. |
There is still machine.SoftSPI. But getting SoftSPI with id=-1 can be dropped. |
machine.SoftSPI works well. At a much slower transfer rate (baudrate=400000) the transer is 1/16 for write, 1/30 for read of that with full speed hard SPI. |
Compiled with
A strange thing is that the binaries created with or without |
I found that after changing parts of the SDK I had to do a full clean with Another question. Besides setting
And have the conditional |
No, of course not, as I'm a neewbee in this regard. |
I discovered
Compiled with So this could be the way to get rid of both the HS SPI 8k buffer as well as the 8k DMA buffer. |
Depends on how the switch is used: With #define SPI_USE_DMA 0 and #define TLS_CONFIG_HS_SPI CFG_OFF simple hardware SPI should still work for any use including SD card. Otherwise it's not a feasible option. |
Found it in w60x/modules/modhashlib.c. It seems that the internals of mp_obj_malloc_var() had changed. Edit: The culprit was most likely commit |
I made a short search: This is the only occurrence of |
I did the same search before pushing the commit. |
Unfortunately Webrepl still does not work as last year. At the w600 a |
No problem here. But it may be a different topic. Try to open a USB session first until you get a REPL prompt, and then close it again. |
At the Wemos and Thingsturn boards, RTS of the USB/Serial bridge is connected to Reset of the W600. At the Wemos and newer Thingsturn boards by a 100nF cap, at older Thingsturn boards direct. These need USB to be started once to boot the w600. I have a Wavgat 602 here without these connections. I can power it from a wallwart USB power supply, and it accepts and runs a Webrepl session just fine. |
Thank you. I'll try again later. |
I took care that WIFi is up and connected before starting webrepl at the board. webrepl_setup puts the start of webrepl into boot.py. That may be before WiFi is connected. |
I started webrepl from the command line. I have WIFI setup in boot.py. Perhaps I shall setup webrepl in main.py. |
This time I was very fast: I managed to enter my password and afterwards even entered |
Strange. Which board do you use? I tried 3 different board, and all work reliable. Maybe the WiFi connection dropped, or a power supply issue. |
I used Wemos W600-PICO. |
Same problem with this board, from screen. Everything like with MP 1.20 but webrepl disconnects after about 7 seconds. |
I built my own image and now the |
Here is my image, if you-d like to try. I edited the Makefile so that secboot is 0 and FatFS is 1. |
I used the image from my web site and that one is working well too. I tried your image and that one works as well. No timeout. No disconnect. |
That is a mystery now. |
Which browser do you use? I use Firefox and the latest Debian stable Linux. |
Here the communication locks up after about 10 minutes of silence with the message at the board: |
I started another test with a Thingsturn board, where I've cut the connections between RTS and reset and pulled reset to 3V3 by a 12k resistor. At all other boards there is not external pull-up for reset. RunnIng now for >1 hour. |
Brave on Manjaro. Perhaps dupterm should retry on small read/write errors.? But I rather think there is another regression present. |
I do not expect that to be useful. The IP stream should have it's own transport layer reliability.
Hard to tell without being able to repeat it. The last test is running now stable >2 hours. |
O.k., my webrepl is here: Next idea: I will start WIFI as AP I found the problem: in my with that commented out, webrepl runs fine. |
Sounds fine. I had two boards here running fine since 5 and 7 hours. At the one Wemos W600 which stopped after 10 minutes before I added a strong pul-up at reset to 3V3 (56 Ohm). The other board had alreaday a pull-up. Maybe that helps as well. I'll try tomorrow again w/o the 56Ohm pull-up. |
Now even vshymanskys viper-ide starts with the w600. Although it has an error as soon as one wants to use the filemanager at the left. But its webrepl works now and the files are displayed at the left... |
The two w600 here are connected and running now since 16 and 18 hours. So I consider them as stable. |
I was puzzled because your w600 tests of the web_repl with viper-ide were succesful. |
I tried Google Chrome as well and it works fine. Maybe it's a problem of Brave. |
Just commented at viper-ide github. |
Checks
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
I've searched for existing issues regarding this feature, and didn't find any.
Description
We continue here the discussions
Compilation of w600 port and
Compilation of w600 port II - II (all closed now)
of development/debugging the w60x port in MP branch w60x.
Code Size
No response
Implementation
The text was updated successfully, but these errors were encountered: