Parallax-ESP Module Latest Hack

145679

Comments

  • Right, the names were changed to protect the innocent.

    Mike
  • iseries wrote: »
    Right, the names were changed to protect the innocent.

    Mike

    Classic !
    LOL :)
  • iseries wrote: »
    Right, the names were changed to protect the innocent.

    Mike
    Well, I'm not sure I'm innocent but thanks for the explanation. Did you get OTA firmware updates working?

  • Is there supposed to be a Makefile for Parallax-ESP32?


    dgately
  • All the ESP32 code is built with Python, so no there is no make file. There are several config files that it reads to build the final product. These are also access with python and a python menu structure.

    No over the air, but that feature is built into the OS.

    Mike
  • I'm confused... (not out of the ordinary)

    This is all C code:
    ~/source/Parallax-ESP32 % ls
    LICENSE     captdns.h   config.c    discovery.h httpd.h     main.c      serbridge.c settings.h
    README.md   cmds.c      config.h    html        json.c      parser.c    serbridge.h status.c
    captdns.c   cmds.h      discovery.c httpd.c     json.h      parser.h    settings.c  status.h
    

    How to compile this?
  • I'm going to continue working on the original Parallax-ESP code moved to the ESP8266_RTOS_SDK. If people think we should be going with the Mike's ESP32 code instead, I guess I can just move my work to a new repository. I need what I'm doing for another project even if it isn't used by Parallax going forward

  • @dgately ,

    Yes, the code is C but espressif has a fancy dangled build system that's based on python. So to build a project you run there configurator python menu that has you fill in what you want to do and what you want included in the build. Then you run the build python program that puts all the pieces together and spits out a complete build file.

    Mike
  • iseries wrote: »
    @dgately ,

    Yes, the code is C but espressif has a fancy dangled build system that's based on python. So to build a project you run there configurator python menu that has you fill in what you want to do and what you want included in the build. Then you run the build python program that puts all the pieces together and spits out a complete build file.

    Mike
    It looks like the build system might even be using CMake although I don't think I have that installed and I am able to build some of the example programs.

  • Yes, they hid a number of things based on what operating system you use to build on. Windows is CMAKE and Unix is make.

    Mike
  • dgatelydgately Posts: 1,385
    edited 2020-12-12 21:10
    David Betz wrote: »
    I'm going to continue working on the original Parallax-ESP code moved to the ESP8266_RTOS_SDK. If people think we should be going with the Mike's ESP32 code instead, I guess I can just move my work to a new repository. I need what I'm doing for another project even if it isn't used by Parallax going forward
    Unless Parallax creates a new ESP32-based WiFi module, your plan seems right... If/when an ESP32-based module becomes available (same form as the current 8266 module), an update could be made.

    iSeries: I'm still interested in an ESP32 solution, using currently available ESP modules (WROOM?). ESP-Now would be interesting for P2 use!

  • dgately wrote: »
    David Betz wrote: »
    I'm going to continue working on the original Parallax-ESP code moved to the ESP8266_RTOS_SDK. If people think we should be going with the Mike's ESP32 code instead, I guess I can just move my work to a new repository. I need what I'm doing for another project even if it isn't used by Parallax going forward
    Unless Parallax creates a new ESP32-based WiFi module, your plan seems right... If/when an ESP32-based module becomes available (same form as the current 8266 module), an update could be made.

    iSeries: I'm still interested in an ESP32 solution, using currently available ESP modules (WROOM?). ESP-Now would be interesting for P2 use!
    It sounds like v3 of ESP8266_RTOS_SDK is quite a bit like the ESP32 SDK so it might be possible to create a project that will build for either. I have a bunch of ESP32 modules I can try it on once I get the 8266 version to build.

  • What do people think about using the Arduino libraries to build the WX firmware? I think I didn't do that initially because the SRAM footprint was too large but that may have improved. I hate the Arduino IDE but the libraries seem to work pretty well. Also, if you do a web search about programming any of the ESP chips you mostly find people using the Arduino libraries.
  • I tried that as well but, the espressif build system seem ok so I didn't see any need to get Arduinos system in the way as well.

    Finding what function you need can be a pain even if the documentation is there. Sometimes I didn't know what the function wanted and what had to be done before I could use it. Sometime dealing with an OS complicates things because of how they implemented them.

    Also when I was putting it together I was using the latest version an the documentation was for the previous version where they changed things up.

    Mike
  • @iseries Could you say how you went about loading the html files into a filesystem on the ESP32? Did you use the SDK flash filesystem?
  • @"David Betz" ,

    You think I can remember back that far how I did that. I'm sure I left those brain cells some where but I just can't quit remember where.

    let me take a look.

    Mike
  • It looks like when you say you want to use spiffs it include an upload_script.html file that I used to place files in the spiffs partition.

    There is a CMakeLists.txt file that has the COMPONENT_EMBED_FILES parameter that you can use to list the files you want to put in the spiffs file system. I only had the upload_script file list so I must have manually put them there as I went along.

    There is also "spiffsgen.py" that will compress a number of files into an upload object that you can include in your project.

    Mike
  • When you say it included upload_script.html do you mean it included it in your flash filesystem image in the ESP flash?

    Any chance you could put your whole project on GitHub instead of just the C source files? It looks like ESP8266_RTOS_SDK v3 is pretty similar to the ESP32 SDK.
  • @"David Betz" ,

    I don't think that will work because the idf.py system builds all kinds of files based on what you pick for the configuration options and what operating system your on.

    In the case of spiffs is builds a configuration file and adds an upload program as part of the process. From there it sets a partition that gets loaded on the ESP32. If that partition is not format it will format it for you. Then it puts an upload html file on the server for you to upload your files to it or you can run some python code and that will wrapper all your website objects up for you and place then in the spiffs on the fly.

    Mike
  • @"David Betz" ,

    I just looked at the ESP8266_RTOS_SDK and it is not anything like ESP32.

    The notes say they will be migrating this to esp-idf in the future.

    Mike
  • David BetzDavid Betz Posts: 14,364
    edited 2020-12-13 17:03
    iseries wrote: »
    @"David Betz" ,

    I just looked at the ESP8266_RTOS_SDK and it is not anything like ESP32.

    The notes say they will be migrating this to esp-idf in the future.

    Mike
    I haven't used the ESP32 SDK so you may be right. the v3 version of the ESP8266 SDK is certainly different from the one we've been using for the WX firmware though. Anyway, I'm still looking for information on loading the SPIFFS file system partition at load time.

    FYI, this is where I got the idea that they were similar: https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/

  • It looks like there is a tool called spiffsgen.py that will build a filesystem image from a directory. Now I just have to figure out how to get it written to flash at load time. I guess I could always invoke esptool.py separately but it would be nice if there was a way to do it as part of the standard "make flash" process.
  • Well, if you know the partition your going to use you would just build the image and flash it along with the rest.

    Part of the spiffsgen.py is to write the data to a partition. So if the image is built then esptool should be able to write it.

    Mike
  • I was able to write the filesystem image generated by spiffsgen.py to the filesystem partition in the flash and the ESP spiffs library was able to mount the filesystem. I was also able to open a file in the filesystem but it appears to be empty. Maybe the filesystem format for the ESP8266 isn't the same as the format for the ESP32.
  • Oddly, I can read and write files from my ESP firmware perfectly well and I can open a file I placed in the pre-loaded filesystem image. However, the file in the pre-loaded image is empty even though the original file has data.
  • So it looks like it's writing the directory entries but not linking it to the actual file data.

    I just was working with my code and what I did to get it going was embed a file in the build process that was later accessed as binary data and pushed out as part of an HTTP request. This page then allowed me to upload files to the spiff.

    Mike
  • Looping back to the fix: #define SSCP_RX_BUFFER_MAX 1024

    That did appear to resolve the issues and get a stable firmware back. I've also extended cgiPropReset to accept an optional param "reset-delay", which defaults to 100ms.

    I'll probably push this version into mfg next week if no-one spots any other issues.
    https://github.com/VonSzarvas/Parallax-ESP

    @"David Betz" Probably this could be sync'd to the main parallax branch too- will be time later in the week to think about that. I'll catch up with Jeff on Wednesday.
    If there is time before the zoom meet on Wednesday I'll create a little C# project to share with everyone that demos remote loading that way. In any event, future programming from Propeller Tool will have the feature.
  • iseries wrote: »
    So it looks like it's writing the directory entries but not linking it to the actual file data.

    I just was working with my code and what I did to get it going was embed a file in the build process that was later accessed as binary data and pushed out as part of an HTTP request. This page then allowed me to upload files to the spiff.

    Mike
    I suspect that I have the block and page size parameters wrong. The error I get is SPIFFS_ERR_INDEX_REF_FREE which makes it seem like the indexing of data blocks is off.
  • David BetzDavid Betz Posts: 14,364
    edited 2020-12-15 03:11
    I got the preloaded filesystem to work. I needed to modify SPIFFS_ALIGNED_OBJECT_INDEX_TABLES to set it to 1 instead of 0 when building mkspiffs. I also had to change the metadata size to match what was specified in the menuconfig. I can now preload a spiffs filesystem populated with the WX html files. Now I have to figure out how to do OTA firmware updates.
    make CPPFLAGS="-DSPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1"
  • David Betz wrote: »
    I got the preloaded filesystem to work. I needed to modify SPIFFS_ALIGNED_OBJECT_INDEX_TABLES to set it to 1 instead of 0 when building mkspiffs. I also had to change the metadata size to match what was specified in the menuconfig. I can now preload a spiffs filesystem populated with the WX html files. Now I have to figure out how to do OTA firmware updates.
    make CPPFLAGS="-DSPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1"

    Great progress- enjoying to read the details as you go.
Sign In or Register to comment.