Lighting an LED on the OM13085 LPCXpresso board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lighting an LED on the OM13085 LPCXpresso board

Jump to solution
2,820 Views
johnwhitmore
Contributor III

I'm trying to get started with the OM13085 LPCXpresso board but NXP don't half make it difficult. Firstly the board I received had a broken jumper. One pad had a dry joint and the other had simply ripped the solder pad off the PCB, still soldered to the jumper. The jumper's function is to disable the debugger, so basically the debugger can't be disabled. If the solder pad hadn't been ripped off the PCB it's be an easy fix.

 

So I can't disable the debugger, I contacted NXP about the issue of receiving a broken board and they responded that I could order another. So they send a faulty unit and I can just replace it by ordering myself another. NXP are not doing themselves any favours here.

 

So moving on. There is a card supplied with the board which points to the web site "Get Started" at http://www.nxp.com/demoboards/OM13085 would it surprise you to hear that that page is a 404 page not found. Cant' say as it shocked me at all. The actual correct address is /demoboard/OM13085 OK there's not much of a difference but I'm having to fill in all the blanks left by NXP.

 

Leaving that aside for the moment you want to do a very basic test and turn on a LED which is connected to Port 3. So you'll have to set the direction register for that port "FIO3DIR". Now we get into an SDK and there is none. If you go to download the lpcopen sdk [1] there is one for the LPCXpresso LPC1769 board but doesn't install in MCUXpresso. You just get an error message to say that this file is not supported by MCUXpresso.

 

So there is no development assistance here so lets try and turn on a LED from first principles. I'll attach a quick C source file but you wouldn't expect it to work would you? The reset address is undefined. It's assuming zero which is what I'd assume as well

 

/usr/local/mcuxpressoide-10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol ResetISR; defaulting to 00000000

 

So lets imagine that I'm not writing for an NXP development board but for a board which uses an LPC1788 MCU. There is no header file supplied by NXP, there are no SDK's to support the device.

 

Even if you buy an NXP dev board you'll still struggle to turn on a simple LED. Perhaps my code is wrong and I've missed a register. Perhaps the reset address is not actually zero, perhaps a lot of things but I'm going to have to wade through as much User Manual for the chip and create a linker script from first principles for a device as there is no SDK.

 

Am I simply missing a world of information, or am I looking at the wrong development environment and the wrong MCU?

 

[1] LPCOpen Software for LPC17XX|NXP

[2] LPCXpresso board for LPC1769 with CMSIS DAP probe|NXP 

Original Attachment has been moved to: main.c.zip

0 Kudos
1 Solution
1,752 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi John,

   Please follow me to modify your code, I have test it on my side, all three color LED is working on my side.

  unzip a new lpcopen code, add lpc_board_nxp_lpcxpresso_lpc1769 and lpc_chip_175x_6x project at first.

  1. open lpcopen code: perph_blinky project

  2. Modify the systick.c code like this:

/*
 * @brief Blinky example using sysTick
 *
 * @note
 * Copyright(C) NXP Semiconductors, 2014
 * All rights reserved.
 *
 * @par
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * LPC products.  This software is supplied "AS IS" without any warranties of
 * any kind, and NXP Semiconductors and its licensor disclaim any and
 * all warranties, express or implied, including all implied warranties of
 * merchantability, fitness for a particular purpose and non-infringement of
 * intellectual property rights.  NXP Semiconductors assumes no responsibility
 * or liability for the use of the software, conveys no license or rights under any
 * patent, copyright, mask work right, or any other intellectual property rights in
 * or to any products. NXP Semiconductors reserves the right to make changes
 * in the software without notification. NXP Semiconductors also makes no
 * representation or warranty that such application will be suitable for the
 * specified use without further testing or modification.
 *
 * @par
 * Permission to use, copy, modify, and distribute this software and its
 * documentation is hereby granted, under NXP Semiconductors' and its
 * licensor's relevant copyrights in the software, without fee, provided that it
 * is used in conjunction with NXP Semiconductors microcontrollers.  This
 * copyright, permission, and disclaimer notice must appear in all copies of
 * this code.
 */

#include "board.h"
#include <stdio.h>

/*****************************************************************************
 * Private types/enumerations/variables
 ****************************************************************************/

#define TICKRATE_HZ1 (10)     /* 10 ticks per second */

/*****************************************************************************
 * Public types/enumerations/variables
 ****************************************************************************/

/*****************************************************************************
 * Private functions
 ****************************************************************************/

/*****************************************************************************
 * Public functions
 ****************************************************************************/

/**
 * @brief     Handle interrupt from SysTick timer
 * @return     Nothing
 */
void SysTick_Handler(void)
{
     Board_LED_Toggle(0);
}

/**
 * @brief     main routine for systick example
 * @return     Function should not exit.
 */
int main(void)
{
     unsigned int i=0,j=0;
     /* Generic Initialization */
     SystemCoreClockUpdate();
     Board_Init();


     Chip_GPIO_WriteDirBit(LPC_GPIO, 3, 25, true); //init GREEN LED
     Chip_GPIO_WriteDirBit(LPC_GPIO, 3, 26, true); //init blue LED
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 1);  //trun off GREEN
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 26, 1);  //trun off blue
     for(j=0;j<100;j++)for(i=0;i<65535;i++);
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 0);  //trun on GREEN
     for(j=0;j<100;j++)for(i=0;i<65535;i++);
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 1);  //trun off GREEN
     for(j=0;j<100;j++)for(i=0;i<65535;i++);
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 26, 0);  //trun on BLUE
     /* Enable and setup SysTick Timer at a periodic rate */
     SysTick_Config(SystemCoreClock / TICKRATE_HZ1);

     /* LEDs toggle in interrupt handlers */
     while (1) {
          //__WFI();
     }

     return 0;
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

3. Build the code, and download it, run the code

  You will find GREEN, BLUE,RED, are all working, you can debug the code.

pastedImage_1.png


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
7 Replies
1,752 Views
johnwhitmore
Contributor III

I discovered that the MCUXpresso IDE was not installed correctly on my Ubuntu 16.04 System so I tried to un-install it. That didn't go well as it half un-installed the IDE to a point where it would neither install because it hadn't been correctly un-installed nor would it fully un-install. I had to backup my computer and re-install ubuntu 16.04 to wipe the entire system.

So now when I installed the IDE into a clean system it has worked and I'm getting the screens which are documented in the User Manual. Unfortunately illuminating a LED is still not possible.  When I create a project I get offered a number of options which require installing of other projects or downloading zip files. For the moment I decided that I'd keep things simple and just create a straight C Project with no SDK/CMSIS Core Library. So with no support files confusing issues I tried a few simple lines of code to light a LED:

#define P25 0x02000000
#define P26 0x04000000

int main(void) {

    // TODO: insert code here
    /*
     * P3-25 Green LED
     * P3-26 Blue  LED
     */
    uint32_t *FIO3DIR  = 0x2009C060;
    uint32_t *FIO3MASK = 0x2009C070;
    uint32_t *FIO3SET  = 0x2009C078;

    *FIO3DIR = P25 | P26;
    *FIO3MASK = ~(P25 | P26);
    *FIO3SET = P25 | P26;

    // Force the counter to be placed into memory
    volatile static int i = 0 ;
    // Enter an infinite loop, just incrementing a counter
    while(1) {
        i++ ;
    }
    return 0 ;
}

I've been over the User Manual for the I/O pins in the LPC1769 and all that seems correct?

0 Kudos
1,752 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi John,

   Do you try to use the lpcopen code like me? Just use the official code, not your own code.

   I can sure, the lpcopen code is working, because I have test it before.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,752 Views
johnwhitmore
Contributor III

I have tried an LPCOpen project and added the code:

    Board_Init();
    Board_LED_Set(0, true);

    Chip_GPIO_WriteDirBit(LPC_GPIO, 3, 25, true);
    Chip_GPIO_WriteDirBit(LPC_GPIO, 3, 26, true);
    Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, true);
    Chip_GPIO_WritePortBit(LPC_GPIO, 3, 26, true);

but that isn't doing anything either. I'm looking at code in Board.c to pull those lines out but they're not lighting any of the three LEDS. Perhaps this is a faulty board, in addition to having a ripped off jumper.

0 Kudos
1,753 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi John,

   Please follow me to modify your code, I have test it on my side, all three color LED is working on my side.

  unzip a new lpcopen code, add lpc_board_nxp_lpcxpresso_lpc1769 and lpc_chip_175x_6x project at first.

  1. open lpcopen code: perph_blinky project

  2. Modify the systick.c code like this:

/*
 * @brief Blinky example using sysTick
 *
 * @note
 * Copyright(C) NXP Semiconductors, 2014
 * All rights reserved.
 *
 * @par
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * LPC products.  This software is supplied "AS IS" without any warranties of
 * any kind, and NXP Semiconductors and its licensor disclaim any and
 * all warranties, express or implied, including all implied warranties of
 * merchantability, fitness for a particular purpose and non-infringement of
 * intellectual property rights.  NXP Semiconductors assumes no responsibility
 * or liability for the use of the software, conveys no license or rights under any
 * patent, copyright, mask work right, or any other intellectual property rights in
 * or to any products. NXP Semiconductors reserves the right to make changes
 * in the software without notification. NXP Semiconductors also makes no
 * representation or warranty that such application will be suitable for the
 * specified use without further testing or modification.
 *
 * @par
 * Permission to use, copy, modify, and distribute this software and its
 * documentation is hereby granted, under NXP Semiconductors' and its
 * licensor's relevant copyrights in the software, without fee, provided that it
 * is used in conjunction with NXP Semiconductors microcontrollers.  This
 * copyright, permission, and disclaimer notice must appear in all copies of
 * this code.
 */

#include "board.h"
#include <stdio.h>

/*****************************************************************************
 * Private types/enumerations/variables
 ****************************************************************************/

#define TICKRATE_HZ1 (10)     /* 10 ticks per second */

/*****************************************************************************
 * Public types/enumerations/variables
 ****************************************************************************/

/*****************************************************************************
 * Private functions
 ****************************************************************************/

/*****************************************************************************
 * Public functions
 ****************************************************************************/

/**
 * @brief     Handle interrupt from SysTick timer
 * @return     Nothing
 */
void SysTick_Handler(void)
{
     Board_LED_Toggle(0);
}

/**
 * @brief     main routine for systick example
 * @return     Function should not exit.
 */
int main(void)
{
     unsigned int i=0,j=0;
     /* Generic Initialization */
     SystemCoreClockUpdate();
     Board_Init();


     Chip_GPIO_WriteDirBit(LPC_GPIO, 3, 25, true); //init GREEN LED
     Chip_GPIO_WriteDirBit(LPC_GPIO, 3, 26, true); //init blue LED
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 1);  //trun off GREEN
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 26, 1);  //trun off blue
     for(j=0;j<100;j++)for(i=0;i<65535;i++);
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 0);  //trun on GREEN
     for(j=0;j<100;j++)for(i=0;i<65535;i++);
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 1);  //trun off GREEN
     for(j=0;j<100;j++)for(i=0;i<65535;i++);
     Chip_GPIO_WritePortBit(LPC_GPIO, 3, 26, 0);  //trun on BLUE
     /* Enable and setup SysTick Timer at a periodic rate */
     SysTick_Config(SystemCoreClock / TICKRATE_HZ1);

     /* LEDs toggle in interrupt handlers */
     while (1) {
          //__WFI();
     }

     return 0;
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

3. Build the code, and download it, run the code

  You will find GREEN, BLUE,RED, are all working, you can debug the code.

pastedImage_1.png


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,752 Views
johnwhitmore
Contributor III

Sh1t, sh1t ,sh1t! Thank you so much for your patience with me. I just had a quick look over your code and saw the line:

Chip_GPIO_WritePortBit(LPC_GPIO, 3, 25, 0);  //trun on GREEN

And realised that the LED I'm trying to light is wired in a reverse logic configuration. 
Here I am trying to write 1, or true, to the port's pin and I should be writing 0 or false.

Thanks a million for your help.
0 Kudos
1,752 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi John Whitmore,

   1. OM13085 hardware broken problem

  From your picture, the PCB pad also broken, so, even you can't fix it by yourself.

I don't know where you buy it, if you buy it from the nxp website, please follow this link:

Returns and Warranty Information|NXP 

Please fill it, just to do the return request.

2. OM13085 Get Started link

  The link in the board card is the old one, now it is replaced by this link:

LPCXpresso board for LPC1769 with CMSIS DAP probe|NXP 

3. LPC1769 sample code

  LPC1769 don't have the SDK code, it just have the lpcopen code, you can open it with LPCXpresso IDE or MCUXPresso, IAR, MDK.

1) LPCXpresso IDE

LPCXpresso IDE v8.2.2|NXP 

2). LPC1769 LPCXpresso IDE & MCUXPresso IDE  lpcopen code

https://www.nxp.com/downloads/en/software/lpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769.zip 

3)LPC1769 IAR & MDK lpcopen code

https://www.nxp.com/downloads/en/software/lpcopen_2_10_keil_iar_nxp_lpcxpresso_1769.zip 

You said, the MCUXPresso can't support the LPCopen code, but I have test it on my side, it works OK, but I am using windown 7 system, I don't have linux system.

This is the debug information, the board LED blinks Ok.

pastedImage_6.png

My PC is the windows system, I can't test the linux system on my side.

I think, maybe you can also try to download the LPCXpresso IDE linux version, and try the lpcopen code.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,752 Views
johnwhitmore
Contributor III

I should perhaps mention that I'm working on a Linux platform for development. MCUXpresso  is installed under /usr/local and the directory '/usr/local/mcuxpressoide/ide/Examples/LPCOpen/' contains a number of ZIp files of SDKs. MCUXpresso says that I can drag and drop a zip file into the window to add it to the IDE but when I do it just says that the file ain't supported. These are files which are shipped with MCUXPresso so I'm not sure if they have been tested.

The user guide [1] suggests, in section 4.1, that there is out of the box support but this does not appear to be the case. Perhaps this works under Windows but I ain't got access to a Windows machine at present.

[1] https://www.nxp.com/docs/en/user-guide/MCUXpresso_IDE_User_Guide.pdf 

0 Kudos