efm8-arduino-programmer
efm8-arduino-programmer copied to clipboard
Update for Nano and Uno
It seems there is fork that simplifies a bit the firmware Upload: https://github.com/christophe94700/efm8-arduino-programmer
@christophe94700 Could you please try and merge upstream? @conorpp If possible, could you switch to using flash instead of server/client? It seem based on a few other forks that PORTD is compatible with Uno and Nano. Does mega support PORTD?
Hi, it's very difficult for me to speak english because i am French. For my question, it's possible to write a long text for my comprehension. Thank :)
@christophe94700 Hey, pas de problème! J'ai vu que vous avez fait de bonnes améliorations au code. Ma demande était que vous faites un PR (Pull Request) au dépôt de code original de @conorpp . De cette façon, d'autres personnes bénéficient de votre amélioration.
I hope I got that right in French. I understand a little as I learned in school (I'm from Romania).
Je ne suis pas un spécialiste de GIT, on fait comment un PR? It's not easy !
The python class PI()
implements the programming interface to the arduino.
@christophe94700 implemented a direct programming way by writing the following code:
port=sys.argv[1]
firmware=open(sys.argv[2], 'r').read()
programmers = PI(port)
programmers.prog(firmware)
To update prog_client.py
to support direct programming should be straight forward. I agree that a "direct" method is better for most people rather than server/client. I would like to keep an option to connect to a server though. I appreciate any PRs.
Your comment on PORTD. This is just the "raw" mapping of the GPIOs (rather than the arduino pin 0, 1, etc.) and are used so that programming happens quicker. The downside is that the PORT/PIN to arduino pin mapping is different for each microcontroller and you have to look them up. To use the code on other devices, you just have to change PORT/PIN correctly.
Here is the mapping for arduino mega 2560 chip. To use arduino mega pin 2, use PE4 (PORTE, pin 4). Any of the arduino digital pins should work. Here are the mappings for Uno and Nano.
Hope that makes sense.
@conorpp makes sense. I think the approach that would benefit all would be:
- Extract configuration of PORT/PIN outside of
https://github.com/conorpp/efm8-arduino-programmer/blob/master/prog/prog.ino
and allow different configs based on platform - Extract flashing logic in a separate file and allow both a client and a direct firmware uploader (bypassing server).
@christophe94700
Thank you for your fork. I tried it on a UNO. I get only this
Can you give me tipp or do you have an idea whats wrong?
Hello Jason, Have you programmed your Arduino with the classic IDE?
Hello @christophe94700 yes i used for programming the Arduino classic IDE V.1.8.5 Just used Python from Atom.io for flash.py
it's run for me. No problem
I use a Arduino Pro mini 3.3 Volt (Atmega 328) "for Arduino Uno and maps C2D and C2CK to digital pins 5 and 6, respectively." I use D5 and D6 Correct or missed i something? Directly connected a USB - serial Adapter (CH340)
Does still not work for me. Got it finally programmed with a forked Tasmota build. https://github.com/ErikAndren/Sonoff-Tasmota/tree/add-rf-flash-5.14
Thx for your help!
Dear all,
I using NANO and python 2.7, Winxp, seems suck, please help.
C:\Documents and Settings\Dev\Desktop\efm8-arduino-programmer-master>python flash27.py COM6 RF_Bridge.hex
Once
Connected
x: 0x81
PI initiated
Device erased
0x0 0x0 0210D6ED24F8FEEFD39E4015ED2408FDE433FCC3EF9DEC6480F874809850028001C32202
0FB7E4F5A922220213C87EFFEFD394004022EF9480501DE4FDED75F00EA42426F582E43419F583E4
93B50704AE0580040DBD06E5AF06220211ED1218C153D87853DBFE121882E4900085F022D2DE2202
141BD201121692C290C296D280E4FBFD7F1012186912064374A4F0D2AFE4F52FF530D2960530E530
7002052FB410F3E52FB427EEC2963001091215A98E328F338006753201753300E5337004E5326401
70409000CCE07007F52FF5300202870530E5307002052FD39410E52F94274002D296D3E5309430E5
2F947550
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
x: 0x43
Traceback (most recent call last):
File "flash27.py", line 109, in
Hello @clementchik0308 no need anymore to use extra hardware to program the efm. Programmer is now included in Tasmota https://github.com/arendst/Sonoff-Tasmota and https://github.com/arendst/Sonoff-Tasmota/pull/2886
@Jason2866
Great, will try. Thanks!
Which version of rf bridge do you have? With R1 you just have to connect the wires as described in the Rf Bridge and upload the Efm firmware over the webconsole -> menu firmware upgrade (file). As simple as it sounds 😃 For R2 you have to swap the wires and power the bridge over the pinheader with 3.3 Volt.
@Jason2866
I got error "Magic byte is not 0xE9" when upgrade.
Program Version 5.14.0 Build Date & Time 2018-05-15T15:29:54 Core/SDK Version 2_3_0/1.5.3(aec24ac9)
Did you use the version included with Tasmota?
Yes, i did but same.
You have to build Tasmota by your own! Branch development!!! No prebuilt version. You have to look in user_config.h for #define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB that this is active
After re-build the tasmota have below complie error.
C:\Documents and Settings\DEv\Desktop\Sonoff-Tasmota-5.14.0\sonoff\xdrv_06_snfbridge.ino:49:17: fatal error: ihx.h: No such file or directory
#include "ihx.h"
^
compilation terminated.
exit status 1 Error compiling for board Generic ESP8266 Module.
Which ide do you use? I cant help with Arduino. I use Visual Studio Code with Platformio. Setup here is just copy downloaded and extracted Tasmota in a folder open that folder in Visual Studio Code and Hit compile Icon. Nothing else for a unmodified working version
Found lib location issue, fixed.
Thanks Jason2866
@Jason2866
Even using 6.0.0a, still "Magic byte is not 0xE9" error.
Program Version 6.0.0a Build Date & Time 2018-06-18T03:42:31 Core/SDK Version 2_4_1/2.2.1(cfd48f3)
Hmm, dont know why. This is the error when the efm part is not in the compiled version. Do you have the correct user_config.h? Not a old one that is used?
A other hint dont use SDK 2.4.1 it is buggy many issues.... With 2.3.0 for most users it works perfect
Problem solved, related to file formatting.
@Jason2866 Found wifi led always off. Any chance to control the wifi led on when wifi connected in tasmota?
@clementchik0308 Regarding: fatal error: ihx.h: No such file or directory
Found lib location issue, fixed.
Can you tell us how you fixed this?