10 years, 9 months ago.

UDP/TCP or any example with ethernet infterface

Hello,

has anybody run lately any example with ethernet interface on LPC1768? I imported UDP hello world, TCPsocket hello world and even MQTT example. All of them gets trapped inside semihost_uid on breakpoint instruction when they are asked for mac address.

Regards, 0xc0170

2 Answers

10 years, 8 months ago.

I solved this by adding some macros. The problem was caused by CMSIS_DAP and semihost request as previously pinpointed. If anybody faces same problem, there will be soon available macros for setting own mac address (MBED_MAC_ADDR_x). If set, that address will be used which allows to debug through code using cmsis-dap.

Regards,
0xc0170

Accepted Answer

I don't understand why these macros were required. Why couldn't you just provide your own implementation of mbed_mac_address() and return your desired mac address from there? If you write your own version of this function, it should be called instead of the default 'weak' mbed implementation and then it won't issue the semihost breakpoint.

I will also point out that this is a bug in the CMSIS-DAP implementation in the interface chip. It should recognize this as a semihost request and handle it as such.

posted by Adam Green 16 Aug 2013
10 years, 9 months ago.

This is the ethernet code trying to make a semihost call to the interface chip to extract its unique mac address. If you are running the code on a non-mbed LPC17xx device then hitting this breakpoint would be expected since you don't have the interface chip to trap this breakpoint and return the required address. You can see forum thread for more information on how to provide your own mac address and stop this breakpoint from being hit on non-mbed devices. If you are hitting this on an actual mbed LPC1768 device when using the CMSIS-DAP debugger then I would classify it as a bug in the debugger code since it should see that it is a semihost request, handle it, and then continue execution of your code.

I forgot to mention I am using the mbed device. Note that I have mbed device just third day :-)

I have read that forum thread, I even called that function to retrieve a mac address from the main in a small application, it printed it and run flawlessly. But in those examples I previously mentioned, it gets trapped.

Update1: It seems an application is working if I flash it. It does not with debugging, seems like I am out of luck to debug any ethernet code with CMSIS-DAP.

Update2: I really have to flash it with bin file. If I load a program through KEIL, it's seems it is not functional after reset.

posted by Martin Kojtal 09 Aug 2013