M2RET Enhancements + M2_WIFI/BTE & ELM327 Support/Emulation

Adding M2_WIFI/BTE support to M2RET
After the M2RET software is uploaded to the M2 it will test if the M2_WFI/BTE module is installed & if so will upload the BTE/WIFI firmware stored within the M2RET software to the BTE/WIFI module & support the ELM327 AT command set & interface to the popular ELM327 software that is in the wild.
If the M2_WIFI/BTE is present it will be also possible to interface to the M2 from Savycan over either BTE or WIFI.
Additional future possible options

  1. Download the saved data via BTE/WIFI from the M2 onboard SD card & reinitialise
  2. Interface Wireless/Blutooth to the M2RET software installed in the M2 to reconfigure M2RET

That all sounds really cool to me! I think it’d be pretty cool to be able to connect to the M2 wirelessly. I’ve meant to do this for a while now but just got busy with other things. Well, I did add ELM327 support and it theoretically does work with an XBEE module but I never tested it very well. It’s likely in somewhat sad shape and needs work. So, it sounds like you plan to push it the rest of the way and create a nice implementation. I’m all for that!

I like the idea of being able to grab logs stored on SD. I thought of that too but, once again, that just hasn’t happened yet.

Hey Collin and Tony, We’d really like to add you guys to the “Open-source Patron Program” list as described here. That way, in about a week when our final surveys go out, some of our backers can select your projects to contribute towards. Is that cool with you guys?

@t_doust WOW! Do you really have those projects working? We would LOVE to give it a try, especially the wireless SavvyCan feature.

Hi Josh
Adding myself to the “Open-source Patron Program” list is fine by me
I am not there yet to release the software for testing. Am having some challenges in determining that the M2WFI board is present as well as some challenges in storing the M2WIFI firmware inside the M2RET software & then uploading the firmware to the M2WIFI module. Once i have mastered these challenges i will release the revised M2RET to you for inclusion as a replacement on GITHUB. Please note with the first release the WIFI firmware will just be a pass through without too many smarts included. The M2WIFI smarts will follow in further releases.
I will be sure to keep you in the loop as to the progress.

On a side note the other 2 lines to change in the ESP32 boards.txt file are below. On my computer i have copied the ESP32 section & prefixed the esp32 with Macchina_esp32. The reason for doing this is it shows up in the boards manager with a more distinctive name. By commenting these 2 lines out with “#” it forces the compiler when uploading to use the next line for upload speed selection & not to upload at 921600baud this then enables all the serial interface lines in your upload program can be set for 115200baud, this way uploads are more reliable albeit slower & you do not have to worry about trying to change speeds after putting the M2WIFI module into programming mode.
"#Macchina_esp32.menu.UploadSpeed.921600=921600"
"#Macchina_esp32.menu.UploadSpeed.921600.upload.speed=921600"

regards Tony

Josh
Further thoughts on the M2_ESP32_WFI module it may be prudent to talk to the good people at esprissif to to have a configuration for the M2_ESP32_WFI module included in the boards manager as they are the manager of this that way when esprissif update their arduino software any changes for this board will be in the wild. I can send a copy to you if you wish along with a few changes i have made to your M2_ESP32_Flash program.
I am also working on (trying) in my spare time which there is not much of at this time to modify the M2_ESP32_Flash program to detect when upload programming has completed & then automatically take the M2 out of flash mode.
Tony

@josh Yes, of course I’m fine with being part of the open source patron program. There are all sorts of things I want to do yet.

@t_doust Your best bet is to issue a pull request to me if you know how to do that on github. Then my changes and your changes to M2RET can both be merged together more simply. Otherwise it is tough to have multiple developers working on the same code base. But, if you can’t do a pull request then I can manually merge your changes in anyway. It’d probably just take a little longer. Also, for a wireless SavvyCAN connection - how did you plan to do that? Currently savvycan gets data either from a serial port or socketcan device and I don’t know how easy it is to create a serial port over wifi. Are you able to create a serial port out of a wifi socket? That’s a kind of slick thing if it works! Otherwise it is possible to add another mode to SavvyCAN - perhaps an IP option where someone could select an IP address and port number to create a TCP or UDP socket.

So, you’re using the Expressif module huh? I have one as well (an early version of it I think) and I’ve done work with the ESP32 on another project. So, I’m pretty familiar with it. The code in M2RET so far is geared toward the XBEE modules but might be use with ESP32 to some extent. It does always seem a little tough to program the ESP32 module. On my other project I created a sketch that I can switch back and forth between uploading and passthrough serial port. But, I never ended up with a really good solution.

Collin
Programming is not my profession just a hobby.
Not a big user of GITHUB and will have a learning curve to get over. I will give this a try re M2RET.

My thoughts were to be able to advertise connections from the M2WIFI module via Buetooth & wireless simultaneously that way when a connection is made the WIFI module would use the active connection. As you are more than aware with the Bluetooth connection on a windows machine a serial port can be easily created for use with Savycan. With the WIFI connection i was considering just advertising a UDP connection that could be used by Savycan. Hadn’t thought of using a wireless UDP & creating a serial port from this. I will look into this further. If possible this would be a cool addition & then no need at this present time to modify Savycan. Long term would be cool to have a Savycan connection via IP.
Tony

Yes, the ESP32 does, in theory, support advertising as both bluetooth and wifi at the same time. I think it will end up doing one or the other once someone connects but that tends to be fine. Bluetooth can indeed present itself as a serial port on the PC side so there is no trouble there. BT latency is quite a bit different from USB latency but the nasty details of that are mostly hidden from view. I think the average CAN bus could easily be streamed over BT without any trouble. For higher throughput there is the possibility to create a UDP socket and stream over at high speed. It isn’t a problem to add IP networking support to SavvyCAN as doing so is pretty cross platform. But, it would require some additional code. So, keep me posted. I can make changes on my side if needed or help answer questions.

While I am working towards building a J1850 library I have been going through the due_can and M2RET code to try and understand how the Arduino interfaces work etc. I can certainly help with this effort and it helps me to better understand M2RET which will be necessary once I get J1850 working.

I have touched base with Tim at GRIMM who has been working on stuff for the M2 as well. I will try to see if I can merge any of his work into the current code base and at the same time can help with other things as well.

I have hope that with the recent information I picked up and with Tim’s help after Defcon I can be more productive helping out.

I have been a Hobbyist programmer for about 35 years and am currently finishing up a Computer Science degree. I have worked with this sort of stuff in the past just not Arduinos specifically.