Is mbed like Arduino ? - Page 1
Forum section: electronics / general

author: ez24
author_rank: Super Contributor
timestamp: December 02, 2016, 07:07:06 pm
content: This is from a topic I posted on a mbed course:QuoteI do not know anything about mbed but I keep think of trying to learn something about MCUs using mbed. I know it is a good idea because of the online IDE and compiler but is this true about mbed ?

author: Jeroen3
author_rank: Super Contributor
timestamp: December 02, 2016, 08:07:34 pm
content: Mbed provides the same api for several platforms. And serves you advanced stuff like filesystems and internet.It had an IDE in web browser, which downloads an .bin for mass-storage bootloader.It's comparable to Arduino, except mbed is only for 32 but ARM while Arduino covers more platforms.Mostly AVR 8 bit though, which is fairly limited in what is can do without much optimizing.When you're advancing you can download your projects into an local ide, such as keil or others.And they open sourced the library, but this is rather high level abstraction code which is hard to follow.So yes, it provides the same beginners level. But is more versatile to grow with.

author: jnz
author_rank: Frequent Contributor
timestamp: December 02, 2016, 09:06:19 pm
content: Ah, so I was pretty much exactly right. That was my quote from the other thread. I win!

author: janoc
author_rank: Super Contributor
timestamp: December 02, 2016, 09:24:42 pm
content: Quote from: jnz on December 02, 2016, 09:06:19 pmUm, now that you have satisfied your ego you can start to actually use mBed and you will discover that the actual experience is very far from an ArduinoEspecially when documentation, community and support are concerned. Also the complexity is an order of magnitude higher, IMO, once you go beyond blinking a LED or servicing a button. That doesn't mean it is bad, only that there is much less handholding and safety net compared to the Arduino tools and libraries while you are dealing with much more complex hardware compared to the typical 8bit Arduinos.*So saying it is the same kind of thing is a tad oversimplified - like comparing a regular train and a Shinkansen. Well, both are trains ...* Yeah, I know that there are also the 32bit ones and what not, but they "dumbed down" to the 8bit level complexity by abstractions and pretty much nobody uses them, because they are so expensive.

author: jnz
author_rank: Frequent Contributor
timestamp: December 02, 2016, 09:55:01 pm
content: Quote from: janoc on December 02, 2016, 09:24:42 pmUgh. That's not going to be nearly as fun :\I signed up for the week of webinars covering mbed. We'll see. I think it's going to be too high level for how I like to code, but I'm curious if it would be at all possible to take components like file system or USB or Bluetooth and modular add them to my non-entirely-mbed projects.

author: rstofer
author_rank: Super Contributor
timestamp: December 03, 2016, 01:17:17 am
content: Quote from: ez24 on December 02, 2016, 07:07:06 pmAny time you use a library, you have to wonder 'who wrote this thing?' and 'did they have any idea how it should be done?'. Some libraries are better than others.The online IDE works well. You can, if you wish, rip the entire project to your local machine (including libraries) and use any other enviroment that supports the language (based on GCC) and the device. I have done it with Rowley Crossworks and everything worked fine.You really don't want to write your own network stack if you can avoid it. The mbed stack is based on the very well establish lwIP stack. The only thing the mbed folks did was add the device driver. It is plug-and-play but you have to use it in a super-loop. Examples abound!The original mbed, the only one I have used, is a 96MHz LPC1768 32bit ARM with Ethernet and USB capability. It has 512k of Flash and 32k of RAM plus another 2 banks of 16k of RAM.https://developer.mbed.org/platforms/mbed-LPC1768/The average Arduino is a 16 MHz 8 bit AVR with no Ethernet or USB. It has 32k Flash and 2k RAM (ETA: Arduino UNO)In concept,both systems hold your hands, if you need it. You can use their libraries if you wish or you can deal directly with the hardware.There is a downside to losing some of the mbed IO ports due to a lack of pins in the 'stamp' arrangement. If you did a bare board, you could have all of the pins but you would lose the bootloader feature.Performance wise, there is no comparison between the Arduino (think Yugo) and the mbed (think Ferrari). But when I want something down and dirty, the Arduino is laying on my bench. Go figure...

author: janoc
author_rank: Super Contributor
timestamp: December 03, 2016, 01:29:37 am
content: Quote from: jnz on December 02, 2016, 09:55:01 pmWell, you will see. If you are not fluent in C and familiar with the hardware, you will probably struggle. mBed is higher level and papers over some nastiness of the underlying vendor libraries, but you pay for that by it implementing the lowest common denominator of functionality. So a lot of capabilities your chosen chip could do won't be accessible from mBed without getting hands dirty and using the vendor libraries or poking registers directly.Arduino is a lot more complete from this point of view, but that is mainly because the ATMegas are so simple MCUs with few peripherals. Any of the ARMs supported by mBed have 10x as many peripherals, registers and advanced functions and only minimum from that is exposed by the mBed libraries.Re reusing the USB or network stacks - you can always use the vendor libraries, all that mBed does is a simplified wrapper over those. E.g. for STM32 they use ST's HAL libraries under the hood.

author: rstofer
author_rank: Super Contributor
timestamp: December 03, 2016, 05:24:54 pm
content: Janoc has a point: Where are you on the coding capability scale? Embedded programming, at the chip level, is fairly complex work. Mostly, it requires a LOT of reading.I don't think you'll have a problem with the Webinars, it's not like they are graded. Even if you are just beginning, you will be exposed to a lot of concepts. You might not retain the details but at least you'll know there is a topic worth discussing.If this is your very first attempt at embedded programming, I might recommend the Arduino simply because everything that can be done with the chip has been done. Multiple times! There are projects all over Google.The mbed also has a lot of projects out in the ether and you can certainly use the demo code from the web site. But things get a little more complicated when you want to work with the hardware directly. My big mbed project started out with the requirement for interrupt driven SPI input. There was no library code for handling the NVIC (interrupt controller) but I had previous ARM experience with the LPC2106 and LPC2148 so it wasn't a stretch. I wanted to use the reserved RAM for input and output buffers. That takes a little trick with the C compiler to specify a physical address for the beginning of the buffer. But there's 32k of dedicated memory and I needed all the buffering I could get. Although the solutions are trivial, getting there took a bit of effort.I like the web based IDE for the mbed and I absolutely hate the Arduino IDE. For the Arduino, I like using the free version of Microsoft Visual Studio (Community Edition) with the Arduino plug-in.

author: EBRAddict
author_rank: Contributor
timestamp: December 04, 2016, 03:05:15 am
content: I like the concept of mbed but they could improve. Listing certified working peripherals on boards and screening libraries before promoting them in search results would be helpful.For example the STM32 Nucleo board Ethernet ports are not supported by the mbed core library, yet they show Ethernet peripherals in the site documentation for the board.

author: westfw
author_rank: Super Contributor
timestamp: December 04, 2016, 04:00:43 am
content: QuoteBut ... THAT wouldn't be "Arduino-like" ? :-)

author: janoc
author_rank: Super Contributor
timestamp: December 04, 2016, 02:19:17 pm
content: Quote from: rstofer on December 03, 2016, 05:24:54 pmThe Arduino IDE is indeed terrible for anything beyond the very basic beginner stuff. The Platform.IO (http://platformio.org/) Atom-based IDE is much better not-only-Arduino editor if you don't want to go directly to Visual Studio. VS is quite overkill for Arduino, considering that you can't debug with it anyway and the editor isn't that great, in my opinion. VS also doesn't work on anything but Windows.

author: janoc
author_rank: Super Contributor
timestamp: December 04, 2016, 02:23:29 pm
content: Quote from: westfw on December 04, 2016, 04:00:43 amNo, but it would actually save you a ton of time.This issue with many mBed boards having half-assed (at best) support is one of my largest pet peeves with mBed too. Many boards are certified as mBed compatible, but it means squat - it only guarantees that you will be able to blink a LED on it (sometimes not even that - e.g. when the mBed compiler hasn't been updated for the board before it has been released).Usually you will find out that something isn't supported on your target board only when code doesn't compile or doesn't work and you start digging through the forums.

author: boost240
author_rank: Newbie
timestamp: December 13, 2016, 04:01:44 pm
content: So basically, the mBed and Arduino platforms provide an API(premade libraries?) With functions that allow you to use the hardware without needing to know the nitty gritty details? So if I wanted to directly program to the bare metal with C I could? But I'd more or less be creating my own libraries functions to use the peripherals and such? Thanks

author: Jeroen3
author_rank: Super Contributor
timestamp: December 13, 2016, 05:09:40 pm
content: Yes and yes.

author: zapta
author_rank: Super Contributor
timestamp: December 13, 2016, 05:19:40 pm
content: Quote from: boost240 on December 13, 2016, 04:01:44 pmBoth mbed and arduino allow you to mix. Use libraries for some peripherals and your direct hardware access for others. I found this choice to be very handy on both eco systems.

author: boost240
author_rank: Newbie
timestamp: December 14, 2016, 01:18:26 am
content: Thank you, friends.