Assorted Questions

22 Nov 2009

Mbed is a great concept, but the current documentation leaves a lot of questions unanswered.

For example, I have deduced that the USB serial port uses UART0 on pins 98 and 99. Am I correct?

PeripheralNames.h suggests that TIMER3 is used for a microsecond ticker. Is this so?

Which timer(s) does the PwmOut class use?

How does the local filesystem work? What LPC1768 resources does it use?

What else is going on in the background?

The cookbook HTTPServer page below makes reference to HTTPRPC and HTTPFileSystemHandler, but I cannot find anything about them. A search yields nothing. Are they documented? If so, where?

http://mbed.org/projects/cookbook/api/EMAC/lwip/trunk/HTTPServer/HTTPServer#addHandler

At present, documentation seems to be scattered all over the site. Finding it is a somewhat hit and miss procedure. I would like to see all the hardware and library documentation in one place. The Handbook would be a good place. I confess I am not a huge fan of online documentation. It is ok for answering specific questions, but it can often be difficult to see the bigger picture. What I would really like is a comprehensive Technical Reference Manual as a pdf document.

Paul

22 Nov 2009

I have two more questions.

Where is the Ethernet MAC address stored? How is it loaded into the Ethernet Controller registers?

Paul

22 Nov 2009 . Edited: 22 Nov 2009

Hi Paul,

Mbed is a great concept, but the current documentation leaves a lot of questions unanswered.

Yep, I'd agree too. It's taken a lot of hard work to get to this so I'm really proud that it even *exists*, but we know there is still a lot to do. We'll be trying to document more and more of the details as we go, but it'll obviously take a while.

Asking questions like this is a great way to highlight what specifically is needed, and a great way to get the answers out. Thanks for capturing them.

For example, I have deduced that the USB serial port uses UART0 on pins 98 and 99. Am I correct?

PeripheralNames.h suggests that TIMER3 is used for a microsecond ticker. Is this so?

Yep, spot on.

Which timer(s) does the PwmOut class use?

It uses the dedicated PWM timers that the LPC1768 has.

How does the local filesystem work? What LPC1768 resources does it use?

What else is going on in the background?

The local filesystem is actually supported via semihosting calls to the mbed interface. Semihosting is a method of delegating system calls to a host, such as printf/fopen/fwrite etc. These are usually used to enable a program on a embedded device to access e.g. a filesystem, but on the host computer where a debugger is running, or a console is supported. The actual semihosting calls go via JTAG to the interface. There are therefore no resources really that are used on the LPC1768 (apart from obvious things like RAM for any stdio buffer etc). To be honest, this area is quite involved, so i'd want to spend some time writing it up as a tutorial on the concept and implementations of semihosting. It is also something that hopefully most people don't need to dive in to!

Nothing is really going on in the background in mbed. i.e. there is no monitor or bootloader.

The cookbook HTTPServer page below makes reference to HTTPRPC and HTTPFileSystemHandler, but I cannot find anything about them. A search yields nothing. Are they documented? If so, where?

I'll leave this to the people working on this cookbook project to answer (it's a cookbook project, so not an official mbed library).

Where is the Ethernet MAC address stored? How is it loaded into the Ethernet Controller registers?

The interface on the mbed has a MAC address encoded in to it as part of the serial number. This means every mbed has a unique MAC address! To get hold of it, we implemented another semihosting call, but I haven't made it public yet. But if you really want to, you can get hold of it like:

extern "C" void mbed_mac_address(char *mac);

char mac[6];
mbed_mac_address(mac); // update mac to the unique mbed mac address

Hope that helps answer some of your questions.

Simon

22 Nov 2009

Simon,

Thanks for a comprehensive set of answers. I can't promise there won't be more questions :).

I printed out the MAC address using your code snippet and noticed that it was part of the auth string in the MBED.HTM file on the local filesystem. Does this mean that if I accidentally erase that file or if I reformat the Flash disk, then I lose my MAC address (and serial number)? If so, then you should really really advise users to back up this file.

Paul

22 Nov 2009

Hi Paul,

Feel free to delete the file! It'll just re-appear when you power-cycle using the power of magic.

Simon

22 Nov 2009

Simon,

Good reply!

Perhaps you should rename mbed HQ Hogwarts :)

Paul

23 Nov 2009

Hi Simon,

Simon Ford wrote:
The actual semihosting calls go via JTAG to the interface. There are therefore no resources really that are used on the LPC1768 (apart from obvious things like RAM for any stdio buffer etc).

How does the LPC1768 signal the interface that it requires servicing? Is this what pin 50 is used for?

Simon Ford wrote:
The interface on the mbed has a MAC address encoded in to it as part of the serial number. This means every mbed has a unique MAC address! To get hold of it, we implemented another semihosting call, but I haven't made it public yet.

Does this mean that programs using Ethernet won't run on bare metal hardware?

Paul

 

23 Nov 2009 . Edited: 23 Nov 2009

Hi Paul,

Paul Griffith wrote:
Does this mean that programs using Ethernet won't run on bare metal hardware?

That would be a little dramatic!

No, it just means you'd have to provide your own implementation of mbed_mac_address() that returned a MAC address. It'd be up to you whether this was hard coded, in flash, external eeprom, config file etc etc.

Simon

23 Nov 2009

Hi Paul,

 

Paul Griffith wrote:
The cookbook HTTPServer page below makes reference to HTTPRPC and HTTPFileSystemHandler, but I cannot find anything about them. A search yields nothing. Are they documented? If so, where?

There is no documentation in order to the issue that I'm not happy with the way I've implemented it. Consider it as a little hack. But as the prefix HTTP suggests it's part of the lwip HTTPServer classes. My little project is published in the cookbook repository, so you can have a look around here:

http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk/HTTPServer/HTTPFS.h

http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk/HTTPServer/HTTPRPC.h

http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk/HTTPServer/HTTPServer.h

http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk/HTTPServer/HTTPServer.cpp

Cheers

Rolf

 

10 Oct 2012

Rolf, This is some good work and I have extended some of your samples to suit most of my needs.

Could we get some new ones which make use of the new EthernetInterface instead of the deprecated EthernetIf?