Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 4 months ago.
Problem in running a simple example on LPC1768
Hi guys. I have a problem in running a simple HelloWorld example on LPC1768. I got the example from http://mbed.org/platforms/mbed-LPC1768/ and complied it using Keil but when I programmed it on LPC1768 nothing happened.
What might cause the problem?
I'm pretty sure LPC1768 is fine and working especially since JLink knows it very well. I'm suspicious about start-up file. Since it seems the program is kind of working in uVision debugger and not on the hardware and that's how I got suspicious about start-up file because uVision doesn't need one for its debugger.
I mean when I used Keil in the past I remember we had to import a *.s assembly start-up file in our project for things like initializing PLL and so on. I'm not sure how mbed does that. I really appreciate it if someone explain it.
1 Answer
10 years, 4 months ago.
I don't think you mentioned it wasn't an mbed (it kinda followed from the JLink part), and that it is a LandTiger is relevant. No need to edit mbed-src in this case, since the 12MHz crystal should work by default.
The main question now: Did you change the pin being toggled? LED1 is the name for the pin on the mbed LPC1768 which corresponds with LED1. The LandTiger board has the LEDs connected to different pins. Quick check shows you need JP8 inserted to have the LEDs function. Then instead of using LED1 (assuming you used that one), use P2_0, which should be the correct pin for one of the LEDs on your board.
Thank you.
Yes of course I noticed the pin numbers. Also JP8 is inserted.
What else could it be?
posted by 18 Sep 2014Can you post the program, between <<code>> and <</code>>
(on seperate lines) you are using?
How about debugging? Does it enter its debug mode if you try, and can it go step by step through the program?
posted by 18 Sep 2014Program is in that link I mentioned before. But anyway :
It really has nothing! Just a simple DigitalOut!
I ran debugger in both internal and Jlink mode. In internal it's working just fine. But in Jlink debugging mode it does not work. It goes through functions and lines in this mode but nothing really happens on hardware.
posted by 19 Sep 2014I saw that program, but that uses LED1, you use something else, right? Since that makes me wonder if you might have done (accidently) something else different, just copy pasting your main.cpp rules that out.
posted by 19 Sep 2014Here:
simple DigitalOut
#include "mbed.h" DigitalOut myled(P2_7); int main() { while(1) { myled = 1; wait(0.3); myled = 0; wait(0.3); } }
Then I'm going to try a non mbed program on the board
Just tell me one thing. How can I edit start-up file and things like PLL in a mbed based program?
posted by 19 Sep 2014Delete the mbed lib, get the mbed-src lib instead (http://mbed.org/users/mbed_official/code/mbed-src/), this is the non-precompiled version (and also a bit the beta branch of the mbed lib). You can export this again to your offline toolchain. For your target the system init code is here: http://mbed.org/users/mbed_official/code/mbed-src/file/f2fd4280b2a6/targets/cmsis/TARGET_NXP/TARGET_LPC176X/system_LPC17xx.c. Some of them have other clock setups predefined, on the LPC1768 you don't have that.
posted by 19 Sep 2014
The standard mbed code is made for the board you are compiling for. You can edit that by using the mbed-src lib. But first question: Are you using the mbed LPC1768 board, or another board? If another board, does it have a crystal, and which frequency?
posted by Erik - 18 Sep 2014Like I said I'm not using mbed LPC1768 board. I'm using LPC1768 LandTiger board. I didn't expect it would matter. Yes it has 12.0MHz crystal.
Sorry I didn't get that part about editing mbed-src lib. How can I do that? I didn't find the file.
posted by Mosi Yaghi 18 Sep 2014