Code Monkey home page Code Monkey logo

Comments (16)

mrfrase3 avatar mrfrase3 commented on August 20, 2024 5

I never got around to looking into this, but coincidentally I've been looking into refactoring my application, and the first part of that is re-writing avrgirl, the stk500v1, stk500v2, avr109, and esptools into a new independent npm package.

I've gotten stk500v1 done already and am currently decrypting the spaghetti code that is stk500v2, all with typescript, promises, and automated tests (I envision an RPi with a bank of microcontrollers plugged in that runs all the tests, testing uploads to the actual boards)

Can check it out here https://github.com/duinoapp/upload-multitool

from avrgirl-arduino.

benjaminaigner avatar benjaminaigner commented on August 20, 2024 2

Hi @ all,

I've experimented with WebSerial and the AVR109 bootloader protocol for the Arduino Micro (ProMicro) updater.
With my limited JS skills, I've implemented a proof-of-concept:
https://github.com/benjaminaigner/avr109-webserial

@noopkat THX for the inspiration with your avrgirl project!
Unfortunately, I've no node.js skills whatsoever, so my implementation is "plain" JS
with WebSerial.
If anybody wants to use this code to create a PR on avrgirl, I would be really happy.

from avrgirl-arduino.

benjaminaigner avatar benjaminaigner commented on August 20, 2024 2

@shikshik
You can put the Arduino Sketch into bootloader mode by opening the port with 1200Baud, closing it after 500ms:
https://github.com/benjaminaigner/avr109-webserial/blob/0aaf0a524e2b29bb7b606b24d267c38a124e6965/index.html#L221
But as we discussed, afterwards the Arduino enumerates again as a different serial port, so you have to select the serial port in the browser again.

One caveat (heavily depending on your Arduino, especially the bootloader version): if you reset the Arduino via it's own serial interface, the time spent in the bootloader is limited. Pressing the reset button twice extends this time. Reference: https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/all#ts-reset

Greetings

from avrgirl-arduino.

noopkat avatar noopkat commented on August 20, 2024 1

hi @koriwi,

Thanks for reaching out about this issue. It's not mentioned in the docs for the React demo but in the directory above that there's a caveats section that warns we currently still don't have support for avr109 boards.

The reason why this support will be challenging (but not impossible!) is because if an avr109 board changes its reported product id while in bootloader mode (common on Windows particularly), the previous connection permissions that the user granted will no longer be valid for the "new" device, and so another permission dialog and flow will be needed in order to proceed. This flow would need to happen after the board is reset, which is kinda awkward. We could put the user through an "onboarding" process before we try to flash, where they double opt-in to grant permission to both "devices" first, and then all flashing actions after that would be smooth and without interruption.

I don't currently have the capacity to start working on this support just yet (yay covid-19 2020 etc etc) however it is something I want to definitely aim for supporting in the future. If you know enough about avr109 and serialport internals and you're enthusiastic about contributing, I'd love to see a PR but no pressure whatsoever!

from avrgirl-arduino.

shikshik avatar shikshik commented on August 20, 2024 1

Currently sick (but covid negative :) )
Can't help you right now, but i will come back to this issue

Be well, drink some tea :)

from avrgirl-arduino.

shikshik avatar shikshik commented on August 20, 2024 1

Thank you @benjaminaigner !
I will do some tests and try to solve the second interaction issue. I think I did solve it in my electron project. I will update on my results very soon.

from avrgirl-arduino.

rubendax avatar rubendax commented on August 20, 2024 1

@benjaminaigner So far I've made it so that the upload process is automatically initiated after the device resets, which is one less click, but the user still needs to confirm both ports in separate pop-up windows - and if the user does not confirm the second port within the limited time frame then the flash will fail.

I've tried storing the SerialPort object which is returned from navigator.serial.requestPort() to a variable to be able to be reused later, but I haven't been able to make it work so far. Somehow the SerialPort object seems to be unique every time the device reconnects. That being said, I have never worked with Web Serial before and I could easily just be trying to store the object in the wrong way.

Not relevant to standard Arduino boards, but maybe useful information to share: I've even tried hacking the bootloader so that it reports the same VID and PID in both bootloader mode and regular program mode (unlike most 32u4-based Arduino boards), but this does not seem to have any affect on SerialPort. Even with matching VID and PID, it still appears as a unique serial port every time it connects and therefore requires user interaction.

from avrgirl-arduino.

koriwi avatar koriwi commented on August 20, 2024

Thanks for explaining it in great detail.
I would love to make this happen.
Currently I'm also fighting with windows and it's weird serial port behaviour in my own project. But maybe after i solved that i can have a look :)

from avrgirl-arduino.

shikshik avatar shikshik commented on August 20, 2024

Hey, great project you got here!
I also hit the rock and would love helping to solve this issue.
Can you direct me where to start? I'm more a JS developer, but I'm a fast learner..

Can I override this somehow for mac use at this moment?

from avrgirl-arduino.

koriwi avatar koriwi commented on August 20, 2024

Currently sick (but covid negative :) )
Can't help you right now, but i will come back to this issue

from avrgirl-arduino.

rubendax avatar rubendax commented on August 20, 2024

My JS skills are somewhat limited but I would be happy to help with this in any way I can, even if just for testing.

from avrgirl-arduino.

mrfrase3 avatar mrfrase3 commented on August 20, 2024

Hey, maintainer of duino.app here.

Thanks @benjaminaigner, I had a crack at this a few months ago, due to a few people requesting AVR109 support, to not much success, but I might have another shot now that your example makes it seem possible. Very interesting.

from avrgirl-arduino.

rubendax avatar rubendax commented on August 20, 2024

@benjaminaigner I wanted to report that I tried out your avr109-webserial and it works! Thank you!

I want to try to see if there's any way to make a more desirable user-interaction experience. Even if the double confirmation is necessary, it would be great if there was maybe some way to front-load confirming both ports so that the user is not required to perform any action within a specified time window...

Anyway, thanks so much for your work on this, it's awesome to finally have avr109 flashing in browser.

from avrgirl-arduino.

benjaminaigner avatar benjaminaigner commented on August 20, 2024

@mrfrase3 @rubendax

THX for picking up my example :-).
We (AsTeRICS Team needed an update possibility for the WebGUI of our assistive devices (FABI & FLipMouse / FLipPad ), where we want to spare our users from installing Arduino to update their devices.

@rubendax
If you find some way to improve the user experience, please inform me, we have this annoying problem too; due to the "problem" with different USB devices when using the bootloader, I didn't find a way.

Greetings

from avrgirl-arduino.

shikshik avatar shikshik commented on August 20, 2024

Hey @benjaminaigner, I didn't try your solution yet, I'm using avrgirl-arduino with a desktop electron + reactjs solution. The issue I'm facing is having the user to click the physical reset button twice to make the device go into upload mode. Have you overcome this issue?
I'm about to develop a web browser solution as well, based on my reactjs app, so if your solution fixes the need for clicking a physical button, I might solve your issue as well (+ giving the world an open source reactjs solution).

@rubendax you have my number. Let me know if you want to work this together.

from avrgirl-arduino.

koriwi avatar koriwi commented on August 20, 2024

I'm back :P

In my app https://github.com/freeyourstream/freedeck-configurator i actually have an auto(re)connect implemented. Not for flashing, but for replugging devices without user interaction. works totally fine. https://github.com/FreeYourStream/freedeck-configurator/blob/6714d6cde6cad09bdc204a0cef2283953aeacafb/src/lib/serial.ts#L33

@mrfrase3 project looks good. i would like to add it to my app when it 109 compatible!

from avrgirl-arduino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.