This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Porting MCB2300 examples to MCB1700

Dear all,

I am using Keil MDK 4.12, and MCB1700 board.

I managed to port simple program examples from MCB2300 to MCB1700, but when I try to port more complex program (RL-TCPNet) I found problems with compiling.

Kindly help me to point me to help file or website that have similar sample case, I have search the forum and knowledge base, but no result.

Thank you in advance for your kind help and attention

Ojahan

Parents
  • Problems with compiling are to do with your 'C' language syntax & usage - not to do with the differences between MCB2300 & MCB1700.

    Dealing with compiler errors is a standard part of the programming process in any language on any platform - nothing specifically to do with embedded, Keil, NXP, etc...

    What errors, exactly, are you getting?

    Usually, compiler errors tell you exactly what is wrong - and, from that, it should be easy to fix the problem!

    The key is to read the messages literally; eg, if the message tells you that something is undefined - then the solution is to define it!

    Note that one error often leads to a load of consequent errors - so fix the first error first!

Reply
  • Problems with compiling are to do with your 'C' language syntax & usage - not to do with the differences between MCB2300 & MCB1700.

    Dealing with compiler errors is a standard part of the programming process in any language on any platform - nothing specifically to do with embedded, Keil, NXP, etc...

    What errors, exactly, are you getting?

    Usually, compiler errors tell you exactly what is wrong - and, from that, it should be easy to fix the problem!

    The key is to read the messages literally; eg, if the message tells you that something is undefined - then the solution is to define it!

    Note that one error often leads to a load of consequent errors - so fix the first error first!

Children
  • Project: adc.uvproj (from sample code)
    Tools: Keil 4
    Previously it compile without error, test it on MCB1700 and works fine.

    Later I add simple instruction:

      FIODIR2  = 0x000000FF;
      FIOMASK2 = 0x00000000;
      FIO2PIN  = 0x00000000;
      PINSEL10 = 0;
    

    The compiling msgs are below:
    I try to update the lpc17xx.h file as suggested by John L, but still the problem exists.
    I also try to define path in each file option and directory option to point to where the dependencies located.

    Please help...


    ------------------------------------------------------
    compiling system_LPC17xx.c...
    compiling adc.c...
    adc.c(32): error: #20: identifier "ADC" is undefined
    adc.c(121): error: #20: identifier "SC" is undefined
    adc.c(124): error: #20: identifier "PINCON" is undefined
    adc.c(129): error: #20: identifier "ADC" is undefined
    adc.c(167): error: #20: identifier "ADC" is undefined
    compiling adctest.c...
    adctest.c(27): error: #20: identifier "FIODIR2" is undefined
    adctest.c(28): error: #20: identifier "FIOMASK2" is undefined
    adctest.c(29): error: #20: identifier "FIO2PIN" is undefined
    adctest.c(30): error: #20: identifier "PINSEL10" is undefined
    Target not created
    ------------------------------------------------------

  • I check in lpc17xx.h, it does contain the undefined parameters.

    Sample of lpc17xx.h is below

    /**************************************************************************//**
     * @file     LPC17xx.h
     * @brief    CMSIS Cortex-M3 Core Peripheral Access Layer Header File for
     *           NXP LPC17xx Device Series
     * @version: V1.08
     * @date:    21. December 2009
     *
     * @note
     * Copyright (C) 2009 ARM Limited. All rights reserved.
     *
     * @par
     * ARM Limited (ARM) is supplying this software for use with Cortex-M
     * processor based microcontrollers.  This file can be freely distributed
     * within development tools that are supporting such ARM based processors.
     *
     * @par
     * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
     * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
     * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
     * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
     * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
     *
     ******************************************************************************/
    .
    .
    .
    #include "core_cm3.h"                       /* Cortex-M3 processor and core peripherals           */
    #include "system_LPC17xx.h"                 /* System Header                                      */
    .
    .
    .
    /*------------- General Purpose Input/Output (GPIO) --------------------------*/
    /** @brief General Purpose Input/Output (GPIO) register structure definition */
    typedef struct
    {
      union {
        __IO uint32_t FIODIR;
        struct {
          __IO uint16_t FIODIRL;
          __IO uint16_t FIODIRH;
        };
        struct {
          __IO uint8_t  FIODIR0;
          __IO uint8_t  FIODIR1;
          __IO uint8_t  FIODIR2;
          __IO uint8_t  FIODIR3;
        };
      };
      uint32_t RESERVED0[3];
      union {
        __IO uint32_t FIOMASK;
        struct {
          __IO uint16_t FIOMASKL;
          __IO uint16_t FIOMASKH;
        };
        struct {
          __IO uint8_t  FIOMASK0;
          __IO uint8_t  FIOMASK1;
          __IO uint8_t  FIOMASK2;
          __IO uint8_t  FIOMASK3;
        };
      };
      union {
        __IO uint32_t FIOPIN;
        struct {
          __IO uint16_t FIOPINL;
          __IO uint16_t FIOPINH;
        };
        struct {
          __IO uint8_t  FIOPIN0;
          __IO uint8_t  FIOPIN1;
          __IO uint8_t  FIOPIN2;
          __IO uint8_t  FIOPIN3;
        };
      };
      union {
        __IO uint32_t FIOSET;
        struct {
          __IO uint16_t FIOSETL;
          __IO uint16_t FIOSETH;
        };
        struct {
          __IO uint8_t  FIOSET0;
          __IO uint8_t  FIOSET1;
          __IO uint8_t  FIOSET2;
          __IO uint8_t  FIOSET3;
        };
      };
      union {
        __O  uint32_t FIOCLR;
        struct {
          __O  uint16_t FIOCLRL;
          __O  uint16_t FIOCLRH;
        };
        struct {
          __O  uint8_t  FIOCLR0;
          __O  uint8_t  FIOCLR1;
          __O  uint8_t  FIOCLR2;
          __O  uint8_t  FIOCLR3;
        };
      };
    } LPC_GPIO_TypeDef;
    
    

  • You have incorrect usage.

    You use FIODIR2 - probably assuming it controls the direction for port 2.

    But note in the header file. FIODIR2 is a field in a union, inside a structure named LPC_GPIO_TypeDef.

    You need to look up the variable of type LPC_GPIO_TypeDef that relates to the port you want to control. Then you need to access the relevant fields for that variable.

    And FIODIR0, FIODIR1, FIODIR2, FIODIR3 are there if you want to just perform an 8-bit operation to update the port direction for a group of 8 I/O pins of a port.

    You seem to want to perform an assign of a 32-bit value - this would correspond with the union field <port-variable_name>.FIODIR. Or you only want to change the low byte, in which case you should use <port-variable_name>.FIODIR0.

    If the variable is instead a pointer, you have to use <port-variable_name>->FIODIR.

  • Mark thank you for the information, the problem is solved now,thanks to your direction and also other friends info.

    Again thank you for everyones help
    Hopefully I can also help anytime soon