-
Notifications
You must be signed in to change notification settings - Fork 1.3k
file system issues on pca10059 #1654
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
Comments
hmm -- BUT -- I am finding that sometimes files copied to the PCA10059 doe not show up to the PAC10059 FS.... Recopying them sometimes works -- I have not seen the FS wiped ... yet. |
@jerryneedell Please try to copy data to the drive, while the code runs. Both are meant to write random test data to USB sticks, read it back and test for modified/overwritten parts. |
OK -- I will try to replicate your test setup. It may take awhile for me to read up on f3 and be brave enough to execute it ;-) @dhalbert or @tannewt can you comment on whether or not you expect CP to be able to handle the kind of stress tests that this is performing. For now I'll stick to simple file copies. |
F3 just uses a single task to fill the drive with test data, and after that reads the data back and compares it. A stress test would be dozens of concurrent random reads and writes at the same time. But: On a Windows system with a background virus scanner installed, it may well happen that the virus scanner reads some files, while CP executes code, and the user reads/writes the same or other files. |
@uhrheber comments copied from #1643: That didn't do it. I tested the pca10059 with a simple main.py, that doesn't use any external libs. With the pca10056, it's completely different. It seems that there are still some timing problems. @ jerryneedell Would you mind trying this code?
This code wipes itself on the pca10059, but runs on the pca10056, so I guess it'll also run on the feather_nrf52840. |
i am working on a fix for this. |
@jerryneedell @uhrheber I have a test uf2 for you to try. This fixes a whole bunch of problems with using the internal flash as CIRCUITPY: there was more than one underlying issue. My test was to run the |
@dhalbert Unfortunately, I forgot the boards with UF2 bootloaders at home, and don't have a JLink at work. I only have boards with the Nordic DFU bootloader at hand. Would you mind sending me the .hex file? |
I tried this on a pca10059. loaded new .uf2 and repeated and it seems to work normally |
ah good -- repeated the test with Beta 5 and after file copy and soft reboot - the FS was corrupted!
Does not happen with new build Note: One one occasion, after reloading the new .uf2 and then erasing and reloading the fielsystem I noticed that I successfully transferred adafruit_ble/ and adafruit_bluefruit_connect/ to CIRCUITPY. Then I copied ble_uart_echo_test.py but when I when to run it, the file was not found and it did not appear in a directory listing. I recopied it and it worked normally. |
@uhrheber eber here is the hex: I am on Eastern US time (Boston and NY). |
@jerryneedell I thought of another possible issue with flushing the filesystem properly which might explain the missing file, and I'll check on that this morning. |
@dhalbert You're the best. Did you even sleep last night? The new firmware is much more stable, but still has some quirks. This happened once. When I tried the same again, CP entered safe mode as well, but after replugging, I could delete files and copy new ones. But again, after free space was below 50kB, CP entered safe mode. During all those tests, the original main.py and corresponding libs remained unaltered, and still worked. |
@uhrheber eber I do sleep a regular amount. 😴 😃 I work from home so it's easy to work late and check on things in the morning. The "running out of space" bug is probably separate. It may be a flaw in the FAT filesystem code. |
Based on this testing, I'll merge these changes for now, and make sure we have an issue for "filling up the filesystem". Thank you both. |
Fixed at least partially by #1661. |
I compiled the latest master for pca10059.
The code ran without problems, though. |
I can also see, that CP4 is much slower when writing the flash than CP3. pca10056: pca10059: |
I just had a wiped drive again on a pca10059, running the latest master firmware. |
Which operating system are you using, and how long did you wait after it didn't restart? It sounds like you caught it in the middle before the write was complete. I do have further ideas about making the caching safer and will get you some test UF2's later. Could you also show how you set up and ran the f3 test, just for reference? Thanks. |
In this case, the operating system was Windows 10 Enterprise 1709, because this is what I have at work. After copying over the main.py, I waited quite a while, because when it didn't run, I first started mu to check what was going on, but couldn't get a serial connection, so I decided to replug it. About f3: It's a Linux tool, that most distributions should have in their repositories, on Debian based distros, it can be installed with sudo apt install f3. To write test data, you use f3write path, to read and test the data you use f3read path. There's a similar windows tool called h2testw, but it refuses to write to the pca10059's drive, because it thinks there's not enough space. It can be used for boards with external flash, though. |
I freshly flashed a pca10059, put some libs and example code on it, and let it run for some time, replacing the main.py occasionally. |
Your experience two comments up is familiar. Windows in particular, and Linux to a lesser extent, do not write all the data and metadata to the drive immediately when you write a file. For Windows, this can take up to 90 seconds, for Linux, it's 10-20 seconds or so. Windows has a long delay only with FAT12 filesystems. See https://superuser.com/questions/1197897/windows-delays-writing-fat-table-on-small-usb-drive-despite-quick-removal/ for more information. If you copied main.py to CIRCUITPY via drag-and-drop, or using an editor that does not does a filesystem flush, then it's important to "Eject" the drive after the write, or |
I did eject the stick before unplugging it. And the code didn't run when I copied the new main.py over the older, so I guess the error happened at the moment of writing. On Linux, I disabled all write caching for circuitpython drives. |
@uhrheber I installed |
@dhalbert Just start f3, it'll write until the drive is full, but it seems to have a fixed block size, because it usually leaves some few kB free. |
Is this still an issue? |
We need to test this again. I don't think we've fixed anything that would necessarily fix this. |
I'm not going to block 4.0 on this because most boards use external flash. Moving it to 4.x |
I'm wondering if #1870 might have fixed this. |
I’m having similar issues with the PCA10059 connected to a Raspberry Pi 3. I copied adafruit_ble and adafruit_bluefruit_connect libs to the PCA10059. They use 75.1K of storage. I then loaded a simple BlueTooth test:
It worked once, but on the 2nd try I lost connection and the PCA10059 file system was wiped. I tried several times and the file system kept getting wiped. |
I'm working on specifying the flash layout on nRF boards in one central place instead of spread around, and I'm seeing that the size of the internal filesystem may not be specified exactly correctly. WIll follow up again when I know for sure one way or the other. |
We've fixed a number of bugs related to internal filesystem stuff on nRF52840, so closing this. Let's open a new one if the problem reappears. |
following up on #1649
running this on pca10059 -- test code from @uhrheber
so far - no issues
The text was updated successfully, but these errors were encountered: