Firmware vs. Default program (mBot + mBlock v3.0)


#1

When an mBot is connected to mBlock, 2 options are available in the ‘Connect’ menu:

1/ "Upgrade firmware"
2/ “Reset default program”

What’s the difference between these 2 options?

I’ve peeked in the source code and both options seem to upload a different .hex file, but the difference is nowhere documented…

(Environment: Windows 10 + mBot + mBlock v3.0)


#2

The mBot (or any other arduino board) needs the firmware to run programs.
The Default program runs on top of the firmware to give you the “A”, “B”, and “C” programs.
When you Upgrade the firmware you are loading the latest copy of the firmware onto your arduino board, thereby REMOVING any loaded program that is on there, including the Default Program.
You always need the firmware and in fact it should always be there.


#3

Danjger, are you sure the default program runs on top of upgraded firmware?

Based on a similar implementation of scratch-arduino communication (S4A) I thought that both the default program and the upgraded firmware act at the same level.

That’s how I understood it:

  • mbot is shipped with a factory installed program (the default program) which is standad arduino code;
  • in order to enable mbot (or other arduino boards) to interactively communicate with scratch, you upload to the board a program (the upgraded firmware) which interacts with scratch at low level; this upgraded firmware substitutes the default program, then you can access the board features interactively from mlock);
  • if you upload a scratch program on the board through the integrated compiler (“mbot program” block -> then right click -> upload to arduino) you wipe the upgraded firmware and substitute it with the compiled version of your custom code.

Therefore each of the options do the same thing (upload a compiled program on the board) with different executable code:

  • default program -> Makeblock original Arduino progam (mbot_reset.hex, AFAIK no source code within mblock directory);
  • upgrade firmware -> Code that establishes a communication with Mblock and waits for commands from the PC (needs mblock, the mbot is not autonomous) (mbot.hex, souce code in firmware directory);
  • “mbot Program -> upload to arduino” -> compiles and uploads your program (only if it complies to Arduino code structure with initialization + infinite loop and contains only Arduino blocks) (source code is yours, .hex compiled just before upload).

Sorry for being pedantic, but I’m a newbie and I am trying to understand. If I am wrong I’ll be glad to know.


#4

Honestly I don’t know for sure but typically firmware is a hardware abstraction layer that a higher level language runs on. Arduino needs this and it can be upgraded to better handle the hardware. The cpp code funs on the firmware which I believe could be anything but someone would have to build a different firmware to do that. What we are upgrading is probably the regular firmware just to keep it up to date. see https://www.arduino.cc/en/Hacking/DFUProgramming8U2 for info on what non scratch programmers do. makeblock could be doing something tricky and writing custom firmware but I doubt it. They should be using standard firmware. I could be totally wrong. Anyone else want to chime in?


#5

I think that every program compiled and uploaded to an Arduino board becomes the actual firmware of that board (as a matter of fact, Arduino is an I/O board with user programmable firmware).

These are the first lines of mbot_firmware.ino. which can be found under mblock installation path. I’m too lazy to check now, but I bet that if I compile and upload this program to mbot it will work like if I select “Upgrade Firmware” from Mblock.

/*************************************************************************

  • File Name : Mbot_Firmware.ino
  • Author : Ander
  • Updated : Ander
  • Version : V1.20101
  • Date : 12/29/2014
  • Description : Firmware for Makeblock Electronic modules with Scratch.
  • License : CC-BY-SA 3.0
  • Copyright © 2013 - 2014 Maker Works Technology Co., Ltd. All right reserved.
  • http://www.makeblock.cc/
    **************************************************************************/

It clearly states that this program allows communication between the board and Scratch.
Scrolling the code I see a lot of serial communication stuff and a series of functions that does i/o activity on Arduino ports (through makeblock libraries) based on serial messages.


#6

OK, I just checked your link.
I think Arduino has a “firmware” definition issue. :smile:
Obviusly there is a low level firmware which initializes the onboard hardware and boots the user defined executable program. When you upload the executable on the board through Arduino IDE, it can run on itself, so the whole code (lower level firmware + user defined executable) works as the firmware of that particular device. Arduino runs a firmware, it simply allows a developer to be part of the firm through Arduino IDE.
In order to establish the communication with Mblock, which is an interpreted language running on the PC, the user needs to upload a suitable executable, which substitutes the previusly installed one.
Mblock becomes a big, powerful, programmable (and incredibly funny) remote.


#7

I think you have hit on it. The mblock has a confusing use of existing terminology.
The other odd thing is this “on-line” connected control mode that is super cool but also super hard to explain to non-programmers. Even us programmers get tripped up. I still have no idea if you can have a program loaded and also send command from mblock and have them both work. I seem to recall it happening but I can replicate it. Maybe it was a previous version or I did something wrong. I do like the novelty of this stuff but it can get frustrating since you expect things to have some consistency.
my main goal is to figure this thing out since it is one of the best ways to get kids into robot programming on a real open-source robot versus a toy with limited capability.


#8

I have figured out that “upgrade firmware” uploads the “mbot.hex” and “reset default program” the “mbot_reset.hex”. (I am speculating that the first one is some sort of bootloader for the Arduino.) The ino Arduino files for both are given in the mblock/firmware folder. They are then in the “mblock_firmware” and “mblock_factory_firmware” subfolders. Using the Arduino IDE I have created the hex files of these and replaced the ones that are used by “upgrade firmware” and “reset default program” in mBlock. The uploading still works and the mbot works perfectly with the remote control…

However, … I can not connect with bluetooth from the app anymore which is a shame. It says “Unrecognizable firmware”. Interestingly, when click “recv encode mode” in mblock and upload the original hex files, I get the version number in the text window after running avrdude. Using my own hex files, the version numbers don’t come up… just a lot of zeros…

So… I think we somehow need to fix the issue with the firmware numbers for self-compiled hex files!!! If we can do that, then we can modify the program on the mbot as we wish (which I have in the meantime like adding modes D, E and F) AND keep the bluetooth connectivity with the app which is very nice…

But how do we do that???

Chris


#9

I know it’s been a while, but did you ever get Bluetooth to work?


#10

Regarding the Bluetooth issue, difficult to believe as it may be, there could be a power issue…

Seems when connecting with the app, a resulting “firmware update required” can be a simple problem with the batteries.

Yes, the BATTERIES.

If the power level of the batteries is not sufficient, then the result will be a FIRMWARE UPDATE REQUIRED message (even if you have the most recent firmware)…!

Fortunately, there is an easy way to test this. With batteries disconnected, plug your MegaPi by USB cable to your PC (you don’t need to run the mBlock application, you just using the PC’s USB power).

Then with the USB connected, open the Makeblock app (android or ipad) and try to connect via bluetooth.

If the app connects to the robot, then you know it’s a power issue (battery issue).

Note, the app won’t allow the robot to move, you can only connect (Bluetooth connection will be obvious when the app goes to the robot control screen).

I suggest getting a Makeblock lithium ion battery pack (or similar). That seems to have the power output necessary (I’ve seen those rechargeable batteries helping in other scenarios too).

In my opinion, the Li-ion battery should be part of the Ultimate 2.0 kit.


#11

Hi dave,

Thanks for sharing your advice.
There may be varies causes when the Makeblock APP shows “unrecognized firmware”, like lose the latest firmware, lack of power, wrong connection between Bluetooth module to mainboard, short on some part of the circuit etc. While, due to that the Makeblock APP can’t detect the causes from the hardware currently, it can’t provide proper error messages corresponding to different reason. Undeniable, this is really inconvenient. We will provide feedback to our engineers, hopefully, they can figure out better proposal.

For Ultimate robot, you can buy the rechargeable Li-ion battery or rechargeable nickel-metal hydride, nickel-cadmium (7.4v~12v) which can be bought from amazon or local shop.


#12

Hello,

My granddaughter just got the Ultimate 2.0 Robotic Arm tank for Christmas. She built it via instructions that come with the robot. All ready to go … can not connect via Bluetooth. Very disappointed. We’ve troubleshot until we’re out of ideas. We’ve tried updating the firmware via USB to Serial and it keeps failing. We’ve even sent a test command from mblock and the command doesn’t do anything. We’ve seen “power issues” as the culprit, and have changed out batteries and even fully charged NiMH. We’re leaning toward that maybe there is a “short on some part of the circuit”. Any other ideas?


#13

Hi tjdjensen,

For the Bluetooth connection issue, have you plug the Bluetooth module on the MegaPi board?
If yes, what is the status of the Blue LED on the Bluetooth module. Normally, it should keep slow flashing before connecting to any device?
Here is an instruction to guide connect Ultimate Bluetooth to Makeblock APP.
How to connect Ultimate 2.0 Bluetooth to Makeblock APP.docx.zip (486.0 KB)

For the failing issue while you upgrading firmware for Ultimate, you may refer to this document to do it again have a try.How to Upgrade Firmware for MegaPi.zip (252.4 KB)


#14

Hello,

Yes, we have tried both of the suggestions.

How to connect Ultimate 2.0 Bluetooth - we get the- “Connecting” flashing blue light, Choose Makeblock (5 solid bars) “In the Synchronous information” solid blue light, then a yellow “Disconnect” very quickly, then a screen that says “Syncronization fails, the firmware can’t identify. Please select your device model”. The only choices given are “Airblock” or “Other devices” - solid blue light. Choose Other devices - “Makeblock App” - Upgrade or restore your robot’s firmware. We have followed all of the steps numerous times, too many to count. As the upload fails. We have restarted both the robot and PC. This is why we think there is something wrong with mother board, we think.


#15

Dear Terry,

How about try temporarily remove and disconnect all the electronic modules from the MegaPi board, then upgrade firmware for it and see if it fails?

Once still upload fails, is it possible to have a video chat to double check the issue? My skype account is 1021306172@qq.com, we are available from 9:00~18:30 on working day, China time. Please kindly let me know your available time then.


#16

Hi again,

Thanks for the reply and suggestions. My daughter and grand daughter are heading home today, so they have taken apart the electronic modules from the MegaPi board. She will try and upload the firmware later today or tomorrow. We’ll let her Skype with you if the firmware load fails. Thanks again for your help and suggestions!!! Our granddaughter really wants the robot to work and is excited to do the other modules in the kit.


#17

Hi, I am Terry’s daughter responding.
In order to travel home, we disassembled the robot. Now that we are home, I have attempted upgrading firmware on the MegaPi board without anything attached to it (only PC through USB/serial port), and also tried it with only the battery pack and PC attached to it. Both ways failed. Do you need us to fully assemble the robot again before connecting via skype or facetime?
Thanks so much for all of your help,
Lacey


#18

I tried to look you up on skype by the address you posted above, and am unable to find you. I am available anytime now until 2300 pacific standard time in the US. My skype address is sahara.sunshine@gmail.com. Hope to hear from you soon. Thanks, Lacey


#19

Hi Lacey,

Sorry that this is really a busy day, I just started checking the forum message.
I have sent you a request to add you as my friend on Skype. Please kindly check if you received it.
Besides, may I know your available time?
(We will have three days off for the new year. While if it is okay for you, I still can do video chat with you tomorrow (about 10:00 am, China time) to check the problem.


#20

Thanks! I received and replied to your request. I’ll talk to you at 10am China time.