View previous topic :: View next topic |
Author |
Message |
P_Santos
Joined: 07 Jul 2011 Posts: 114
|
Posted: Fri Apr 05, 2019 4:11 pm Post subject: OTA with Bascom |
|
|
Hello,
I see on Arduino that they make OTA firmware programming
Anyone tried OTA with Bascom for Atmega and Xmega?
Regards
P_Santos
(BASCOM-AVR version : 2.0.8.1 , Latest : 2.0.8.1 ) |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Fri Apr 05, 2019 10:48 pm Post subject: |
|
|
If you search the forum you will find
Programming from SD card
Wireless programming
If you go to bascom help there is bascom boot loader
you could use the bascom boot loader for many methods
I am using it over ether-net via rs232 to tcpip HLK-RM04 modules
With the HLK-RM04 there is no programming in the AVR for tcpip
and you get a full wireless router access point connected to the AVR
Regards Paul |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Sat Apr 06, 2019 9:03 pm Post subject: |
|
|
To update OTA (OverTheAir) you need some additional hardware because the AVR chip doesn't have wireless capability.
As Paul already pointed out there are some examples available on the forum with various hardware.
But doing an OTA like Arduino does with an ESP8266 isn't possible with an avr because of the limit bootloader space. It can be done with an external eeprom as temporary storage and the run a i2c bootloader to copy the firmware to the avr. _________________ www.evertdekker.com Bascom code vault |
|
Back to top |
|
|
P_Santos
Joined: 07 Jul 2011 Posts: 114
|
Posted: Sun Apr 07, 2019 12:23 am Post subject: |
|
|
Hello
I have in my board a Bluetooth HM11 module, how it is possible use this to make OTA, it is possible, preference for Xmega?
Regards
P_Santos |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Tue Apr 09, 2019 9:00 am Post subject: |
|
|
HM-11 is a BT-4.0 BLE module. This kind of Bluetooth dont have "old" SPP (SerialPortProfile) anymore. Data is sent in small chunks (32B for example).
Not all new laptops/PC have BT-4.0 so for programming via BLE you maybe need some additional Bluetooth dongle or smartphone application.
This is not good choice for start with bootloaders. I think cheap HC-05 BT-2.1 or ESP8266 will be better here.
For ESP8266 you can flash it with jee-lab "esp-link" software so you get bridge WiFi<=>RS232 but you still need some application on the PC for sending BIN or HEX via WiFi.
My advice for beginners ->Start with HC-05 and Bascom MCS Bootloader so one can programm with Bluetoth exactly from Bascom IDE. |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Tue Apr 09, 2019 9:16 am Post subject: |
|
|
EDC wrote: | so you get bridge WiFi<=>RS232 but you still need some application on the PC for sending BIN or HEX via WiFi.
. |
This is why I use the HLK-RM04 it becomes a serial port on the PC so bascom runs happily with the bascom boot loader. |
|
Back to top |
|
|
techknight
Joined: 21 Apr 2008 Posts: 231
|
Posted: Fri May 03, 2019 2:30 pm Post subject: |
|
|
Whoops. meant to hit post new thread. Not reply. |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Mon May 13, 2019 4:18 pm Post subject: |
|
|
This is the OTA programming with Bascom related I think.
I try to explain some of My tips quick.
I have My nonexpensive VPS server. I`m using it for MQTT broker, Apache server for new firmware for some devices (they check for new firmware and download it) - this is in the finall tests... but I can also install VPN on it.
VPN I install for purpose of connecting to my computers/devices from anywhere (if they are online offcourse).
But with VPN you can do mooooore, and something like this:
Device that can connect to VPN looks like it share your home/company/domain network so it can be accessed as IP with same subnet.
For 8bit uC`s VPN isnt comfortable but you can connect it over router that can do VPNinternet connection decrypt/encrypt for it.
Best part is that they can be behind x-NAT`s
Now I came to the point where @Paulvk wrote that He uses HLK-RM04.
Okay, but I found some solution for those who want to start with sending firmware over the Internet and this solution cost me nothing for now because Im using it for My one test project. Maybe MCS will perceive in this method some opportunity to make MCS Bootloader work with the IP addresses (on the commercial addon/library).
For making Bascom IDE think, that this port is available, I must run another program that emulate COM PORT but at the end it works like a charm..
I attach only screen here but I have two or three of videos that this method of upgrading software working great but it also enable you to control your remote device by terminall commands...
One thing I must point! I slightly change bootloader.bas it that way:
When it go to first page erase it store flag in the eeprom that the flashing of the new software was started.
This flag is cleared and entered into the eeprom when whole programming process became to the end with the success. If not - I change "Goto __reset" into reset uC and waiting for proper programm.
This fix remote reset.. simply if programming faill Bootloader wait for next chance.
If anyone intersted about how to set up it, if I can I will help |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Mon May 13, 2019 8:43 pm Post subject: |
|
|
The commercial boot loader supports udp and tcp too.
OTA loading works the same as the normal loader. Only the medium is different. It can be BT or simple RF or a GSM module.
Some methods make things simpler. The best way to do it is this :
- in the main application check if an update is required
- if an update must be performed, download this update using either BT , RF or GSM
- store this in an EEPROM or in case of GSM, store it on its file system
- when done, set a flag and reset the processor. a WD time out will do fine.
- at boot, check the flag, and if the new firmware exist, update the flash
this approach has pro and cons. the pro is that you can do almost everything in the main app. and you can keep the boot loader very simple and small.
the con is that you need memory to store the new firmware. gsm modems often have memory that you can use so in that case it is simple.
it is also a good idea to have some emergency recover method. but that would require more space to store different versions of the firmware.
all depends on the actual hardware available. _________________ Mark |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue May 14, 2019 12:56 am Post subject: |
|
|
I think that for any firmware that needs remote upgrades, just add a micro-SD card, even permanently mounted inside. Gives you essentially unlimited scope for upgrades and reversions for very little cost and space. Store the new firmware from OTA on the card and do a validity check, if ok just bootload it from there to internal flash. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
Posted: Tue May 14, 2019 7:26 am Post subject: |
|
|
Hi All,
OTA is possible with an AVR, even with very limited space.
In a project I worked on several years ago (2013) we used a Zigbee radio for communication and I decided to write a bootloader that configured the Radio Module (AT command set) then waited for a new firmware. The actual firmware transfer used XMODEM protocol. I managed to fit the whole thing into just 2K with a few bytes to spare (ATMEGA16).
We've now sold other 1000 units and the OTA option has saved us alot of time and money (customer can perform the update themselves without a visit from service).
Regards
Ian Dobson _________________ Walking on water and writing software to specification is easy if they're frozen. |
|
Back to top |
|
|
Dave
Joined: 05 Feb 2005 Posts: 314 Location: OR
|
Posted: Wed May 15, 2019 5:40 pm Post subject: |
|
|
Hello All.
The HC-12 modules are a good OTA option.
Pros:
They are low cost, about $5.
Easy to use because they just replace your serial cable with two modules.
They work with the MCS bootloader without modification.
They have good range. Much better then bluetooth.
Cons:
Pore documentation. Here is the pdf: https://www.elecrow.com/download/HC-12.pdf
As far as I can tell they are only available at 433MHz band. |
|
Back to top |
|
|
matjazs
Joined: 08 Nov 2016 Posts: 86
|
Posted: Wed May 15, 2019 7:51 pm Post subject: |
|
|
Mark.
Would you describe more detail how GSM modem works with bootloader? Which program is recommended for transfer firmware files through the GSM modem?
I did this always direct with mcs bootloader trough serial interface, but this software don't have possibility that you can make a call (ATD+number). |
|
Back to top |
|
|
P_Santos
Joined: 07 Jul 2011 Posts: 114
|
Posted: Thu May 16, 2019 10:28 am Post subject: |
|
|
Hi,
Like matjazs, i'm intersting too, update firmware trought gsm modem
Mark or other have a tutorial and example code how to do that?
Appreciate any help
Best regard
P_Santos |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Thu May 16, 2019 12:15 pm Post subject: |
|
|
sorry, i can not share the code since it was a paid job for a customer.
but as i explained the mechanism it should not be that hard to do it. _________________ Mark |
|
Back to top |
|
|
|