LPCマイクロコントローラ・ナレッジ・ベース

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC Microcontrollers Knowledge Base

ディスカッション

ソート順:
Getting Started with LPCXpresso54608 & MCUXpresso is pretty straight forward, but we want to make the process even easier.  So we created a simple guide to walk you through the getting started process,       LPCXpresso54608: Out of Box & Getting Started Introduction LPC5460x MCU Family part numbering & feature summary table (highlighted in yellow are the first of many parts to be released). If it wasn't already clear, LPCXpresso54608 is the superset development board for our LPC5460x MCU Family. NXP.com Board Page Board Part Number (OM13092) Board User Manual (UM11035) Board Schematics Key features of the LPCXpresso54608 development board, 272x480 color LCD with capacitive touch screen On-board, high-speed USB, Link2 debug probe with CMSIS-DAP and SEGGER J-Link protocol options UART and SPI port bridging from LPC546xx target to USB via the on-board debug probe Support for external debug probe 3 x user LEDs, plus Reset, ISP (3) and user buttons Multiple Expansion options, including Arduino UNO and PMod Built-in power consumption measurement for target LPC546xx MCU 128Mb Micron MT25QL128 Quad-SPI flash 8MB Micron MT48LC8M16A2B4 SDRAM Knowles SPH0641LM4H digital microphone Full size SD/MMC card slot NXP MMA8652FCR1 accelerometer Stereo audio codec with line in/out High and full speed USB ports with micro A/B connector for host or device functionality 10/100Mbps Ethernet (RJ45 connector)
記事全体を表示
Overview          Ping-pong is a special case of a linked transfer which typically used more frequently than more complicated versions of linked transfers. A ping-pong transfer usually uses at least two buffers. At any one time, one buffer is being loaded or unloaded by DMA operations. The other buffers have the opposite operation being handled by software, readying the buffer for use when the buffer currently being used by the DMA controller is full or empty. The Fig 1 illustrates an example of descriptors for ping-pong from a peripheral to two buffers in memory. Fig 1 Implementation detail         To continuous transfer the converted result of the ADC to RAM, I’m going to use four 4 DMA descriptors to work in Ping-Pong mode to achieve this goal as the Fig 2 shows. Fig 2 Data flow via Ping-Pong mode Hardware introduction         LPCXpressor54114 Board(OM13089) Fig 3 LPCXpressor54114 Board        Demo code: LPCOpen Library Example code        The code is based on the periph_adc demo, using the SCTimer output as the hardware trigger of ADC, meanwhile, the ADC converted value is transferred to the appointed area of RAM automatically. #include "board.h" #define SCT_PWM            LPC_SCT #define NUM_BUFFERS 4 #define DMA_TRANSFER_SIZE 8 #define ADC_INPUT_CHANNEL 1 #define SCT_PWM_RATE   10000          /* PWM frequency 10 KHz */ #define SCT_PWM_PIN_OUT    7          /* COUT7 Generate square wave */ #define SCT_PWM_OUT        1          /* Index of OUT PWM */ uint16_t adcOut; ALIGN(512) DMA_CHDESC_T ADC_TransferDescriptors[NUM_BUFFERS]; uint16_t CapturedData[32]; uint16_t DMA_Sum=0; /** * * ADC IRQ not Used right now... Only for testing */ void ADC_SEQA_IRQHandler(void) {             /* If SeqA flags is set i.e. data in global register is valid then read it */         Chip_GPIO_SetPinState(LPC_GPIO, 0, 6, true);         //DEBUGOUT("ADC Output = %d\r\n", adcOut);         Chip_GPIO_SetPinState(LPC_GPIO, 0, 6, false);         Chip_ADC_ClearFlags(LPC_ADC,0xFFFFFFFF); } void DMA_IRQHandler(void) {         static uint16_t DMA_Sum=0;                 DMA_Sum++;                  if(DMA_Sum ==8)          {            DMA_Sum=4;          }             Chip_GPIO_SetPinState(LPC_GPIO, 0, 7,true);      /* Rrror interrupt on channel 0? */      if ((Chip_DMA_GetIntStatus(LPC_DMA) & DMA_INTSTAT_ACTIVEERRINT) != 0)      {           /* This shouldn't happen for this simple DMA example, so set the LED              to indicate an error occurred. This is the correct method to clear              an abort. */           Chip_DMA_DisableChannel(LPC_DMA, DMA_CH0);           while ((Chip_DMA_GetBusyChannels(LPC_DMA) & (1 << DMA_CH0)) != 0) {}           Chip_DMA_AbortChannel(LPC_DMA, DMA_CH0);           Chip_DMA_ClearErrorIntChannel(LPC_DMA, DMA_CH0);           Chip_DMA_EnableChannel(LPC_DMA, DMA_CH0);           Board_LED_Set(0, true);      }      Chip_GPIO_SetPinState(LPC_GPIO, 0,7,false);      /* Clear DMA interrupt for the channel */      LPC_DMA->DMACOMMON[0].INTA = 1; }      /***       *      ____  __  __    _       *     |  _ \|  \/  |  / \       *     | | | | |\/| | / _ \       *     | |_| | |  | |/ ___ \       *     |____/|_|  |_/_/   \_\       *     / ___|  ___| |_ _   _ _ __       *     \___ \ / _ \ __| | | | '_ \       *      ___) |  __/ |_| |_| | |_) |       *     |____/ \___|\__|\__,_| .__/       *                          |_|       */ void DMA_Steup(void) {         DMA_CHDESC_T Initial_DMA_Descriptor;                 ADC_TransferDescriptors[0].source = (uint32_t)&LPC_ADC->SEQ_GDAT[0];      ADC_TransferDescriptors[1].source = (uint32_t)&LPC_ADC->SEQ_GDAT[0];      ADC_TransferDescriptors[2].source = (uint32_t)&LPC_ADC->SEQ_GDAT[0];      ADC_TransferDescriptors[3].source = (uint32_t)&LPC_ADC->SEQ_GDAT[0];      ADC_TransferDescriptors[0].dest = (uint32_t)&CapturedData[(0+1)*DMA_TRANSFER_SIZE-1];      ADC_TransferDescriptors[1].dest = (uint32_t)&CapturedData[(1+1)*DMA_TRANSFER_SIZE-1];      ADC_TransferDescriptors[2].dest = (uint32_t)&CapturedData[(2+1)*DMA_TRANSFER_SIZE-1];      ADC_TransferDescriptors[3].dest = (uint32_t)&CapturedData[(3+1)*DMA_TRANSFER_SIZE-1];      //The initial DMA desciptor is the same as the 1st transfer descriptor.   It      //Will link into the 2nd of the main descriptors.      ADC_TransferDescriptors[0].next = (uint32_t)&ADC_TransferDescriptors[1];      ADC_TransferDescriptors[1].next = (uint32_t)&ADC_TransferDescriptors[2];      ADC_TransferDescriptors[2].next = (uint32_t)&ADC_TransferDescriptors[3];      //Link back to the 1st descriptor      ADC_TransferDescriptors[3].next = (uint32_t)&ADC_TransferDescriptors[0];      //For a test,  stop the transfers here.   The sine wave will look fine.      //ADC_TransferDescriptors[3].next = 0;      ADC_TransferDescriptors[0].xfercfg = (DMA_XFERCFG_CFGVALID |                                DMA_XFERCFG_RELOAD  |                                DMA_XFERCFG_SETINTA |                                DMA_XFERCFG_WIDTH_16 |                                DMA_XFERCFG_SRCINC_0 |                                DMA_XFERCFG_DSTINC_1 |                                DMA_XFERCFG_XFERCOUNT(DMA_TRANSFER_SIZE));      ADC_TransferDescriptors[1].xfercfg = ADC_TransferDescriptors[0].xfercfg;      ADC_TransferDescriptors[2].xfercfg = ADC_TransferDescriptors[0].xfercfg;      ADC_TransferDescriptors[3].xfercfg = (DMA_XFERCFG_CFGVALID |                                DMA_XFERCFG_RELOAD  |                                DMA_XFERCFG_SETINTA |                               DMA_XFERCFG_WIDTH_16 |                               DMA_XFERCFG_SRCINC_0 |                               DMA_XFERCFG_DSTINC_1 |                               DMA_XFERCFG_XFERCOUNT(DMA_TRANSFER_SIZE));      Initial_DMA_Descriptor.source = ADC_TransferDescriptors[0].source;      Initial_DMA_Descriptor.dest =   ADC_TransferDescriptors[0].dest;      Initial_DMA_Descriptor.next =  (uint32_t)&ADC_TransferDescriptors[1];      Initial_DMA_Descriptor.xfercfg = ADC_TransferDescriptors[0].xfercfg;      /* DMA initialization - enable DMA clocking and reset DMA if needed */      Chip_DMA_Init(LPC_DMA);      /* Enable DMA controller and use driver provided DMA table for current descriptors */      Chip_DMA_Enable(LPC_DMA);      Chip_DMA_SetSRAMBase(LPC_DMA, DMA_ADDR(Chip_DMA_Table));      /* Setup channel 0 for the following configuration:         - High channel priority         - Interrupt A fires on descriptor completion */      Chip_DMA_EnableChannel(LPC_DMA, DMA_CH0);      Chip_DMA_EnableIntChannel(LPC_DMA, DMA_CH0);      Chip_DMA_SetupChannelConfig(LPC_DMA, DMA_CH0,     //(DMA_CFG_PERIPHREQEN     |                                    (DMA_CFG_HWTRIGEN        |                                     DMA_CFG_TRIGBURST_BURST |                                                          DMA_CFG_TRIGTYPE_EDGE   |                                        DMA_CFG_TRIGPOL_LOW    |    //DMA_CFG_TRIGPOL_HIGH                                        DMA_CFG_BURSTPOWER_1    |                                     DMA_CFG_CHPRIORITY(0)                                          )                                        );      //make sure ADC Sequence A interrupts is selected for for a DMA trigger      LPC_INMUX->DMA_ITRIG_INMUX[0] = 0;      /* Enable DMA interrupt */      NVIC_EnableIRQ(DMA_IRQn);      // The 1st descriptor is set up through the registers.      /* Setup transfer descriptor and validate it */      Chip_DMA_SetupTranChannel(LPC_DMA, DMA_CH0, &Initial_DMA_Descriptor);      //Use the transfer configuration for our 4 main descriptors      Chip_DMA_SetupChannelTransfer(LPC_DMA, DMA_CH0,     ADC_TransferDescriptors[0].xfercfg);      Chip_DMA_SetValidChannel(LPC_DMA, DMA_CH0);      } void SCT_PWM_Generate(void) {          /* Initialize the SCT as PWM and set frequency */      Chip_SCTPWM_Init(SCT_PWM);      Chip_SCTPWM_SetRate(SCT_PWM, SCT_PWM_RATE);      /* Setup Board specific output pin */      Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 14, IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);      /* Use SCT0_OUT7 pin */      Chip_SCTPWM_SetOutPin(SCT_PWM, SCT_PWM_OUT, SCT_PWM_PIN_OUT);              /* Start with 50% duty cycle */      Chip_SCTPWM_SetDutyCycle(SCT_PWM, SCT_PWM_OUT, Chip_SCTPWM_PercentageToTicks(SCT_PWM, 10));      Chip_SCTPWM_Start(SCT_PWM);    }      /***            *         _    ____   ____            *        / \  |  _ \ / ___|            *       / _ \ | | | | |            *      / ___ \| |_| | |___            *     /_/__ \_\____/ \____|            *     / ___|  ___| |_ _   _ _ __            *     \___ \ / _ \ __| | | | '_ \            *      ___) |  __/ |_| |_| | |_) |            *     |____/ \___|\__|\__,_| .__/            *                          |_|            */ void ADC_Steup(void) {     /*Set Asynch Clock to the Main clock*/     LPC_SYSCON->ADCCLKSEL = 0;     //Set the divider to 1 and enable.  note,  the HALT bit (30) and RESET (29) are not in the manual     LPC_SYSCON->ADCCLKDIV = 0;      /* Initialization ADC to 12 bit and set clock divide to 1 to operate synchronously at System clock */     Chip_ADC_Init(LPC_ADC, ADC_CR_RESOL(3) | ADC_CR_CLKDIV(0)| ADC_CR_ASYNC_MODE);       //select ADC Channel 1 as input     Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 30, IOCON_FUNC0 | IOCON_ANALOG_EN| IOCON_INPFILT_OFF);       LPC_ADC->INSEL = 0x01;     Chip_ADC_SetupSequencer(LPC_ADC,ADC_SEQA_IDX,                                                                          ADC_SEQ_CTRL_SEQ_ENA |                               ADC_SEQ_CTRL_CHANNEL_EN(ADC_INPUT_CHANNEL) |                                                 ADC_SEQ_CTRL_TRIGGER(2) |                               ADC_SEQ_CTRL_HWTRIG_POLPOS |                                                 ADC_SEQ_CTRL_HWTRIG_SYNCBYPASS |                               ADC_SEQ_CTRL_MODE_EOS |                                                 ADC_SEQ_CTRL_SEQ_ENA);     /* Enable Sequence A interrupt */     Chip_ADC_EnableInt(LPC_ADC, ADC_INTEN_SEQA_ENABLE);         /* Calibrate ADC */     if(Chip_ADC_Calibration(LPC_ADC) == LPC_OK) {         /* Enable ADC SeqA Interrupt */         NVIC_EnableIRQ(ADC_SEQA_IRQn);     }     else {         DEBUGSTR("ADC Calibration Failed \r\n");         return ;     } } int main(void) {       SystemCoreClockUpdate();     Board_Init();         DMA_Steup();     ADC_Steup();     SCT_PWM_Generate();         while(1)     {}     } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍  Verification      Building the project, then click the   to debug;        Generate the sine wave: 1 KHz, 幅度:0~2 V,feed the wave the ADC via the J9_1(P0_30-ADC1);         Setting the breakpoint (Fig 4) to observe the ADC converted value CapturedData[32]; Fig 4                        4. To verifying the result, I collect several group of data and use the Excel to make these data graphical for checking. Fig 6 is an example. Fig 5 Fig 6 Fig 7 Fig 8
記事全体を表示
Unboxing video of the low cost OKDO E1 board.    As a quick demo, I hooked up the E1 to a low cost  240x240 Pixel IPS display from buydisplay.com.
記事全体を表示
First, download the LPCXpresso54608 board User Manual.  After scanning the document, let's get started! Plug in LPCXpresso54608 (as shown below).  You will see the pre-loaded, Out of Box demo, which features Draupner TouchGFX.  A screen shot is shown below, Once you've explored the pre-loaded demo, you will likely want to learn more.   For this you will need to configure and build an MCUXpresso Software Development Kit (SDK) for your LPCXpresso54608 development board. Register or use your login credentials to sign in and download software from NXP. You can create a configuration for the LPCXpresso54608 in one of two ways: By typing 'LPCXpresso54608' or selecting boards>LPC>LPCXpresso54608 Once you have selected the board you will be presented with two options: 'Select Configuration' or 'Specify Additional Configuration Settings'. (It is recommended that you name the configuration something that specifies the settings as this will help identify multiple configurations.)   Note: By default the SDK Builder will choose IAR as the default toolchain for Windows.  For this tutorial we will use Windows as our Development Host OS.  If this is not the desired toolchain or OS please 'Select 'Specify Additional Configuration Settings' The following window will be presented, which allows you to download an SDK for IAR, Keil or Both (selecting 'All toolchains'.).  During this stage, you can also specify any necessary middleware for your download.  You can select or deselect these under the 'Select Optional Middleware' Select 'Go to SDK builder' once you have made your choices. Note:You may be prompted to update your info before you are allowed to download the package. If this happens select the link in the red at the top to resolve any issues. Once the information is updated you can click on the 'Overview' at the top and reselect 'SDK Builder' to return to the screen you were on. You have the opportunity to rename your file one last time before you hit download now. Once you select 'Download Now' you will be presented with a license agreement and once agreed to the download will start. Once you have downloaded the packaged .zip use your favorite utility to extract to a known location --> Continue here if IAR is your selected default toolchain. --> Continue here if KEIL is your selected default toolchain. --> Continue here if MCUXpresso is your selected default toolchain (coming March 2017!)
記事全体を表示
Recently I have several customers experience HardFault error when perform AHB FLASH memory read on LPC55S69. If a FLASH sector has never been programed after mass erase, performing AHB reads of the FLASH memory contents will cause a hardware fault if an unrecoverable error is detected. Why? LPC55Sxx parts are delivered from the factory mass erased with ECC unset. When MCUXpresso IDE connects a chip via LinkServer, it will firstly erase the sectors that will be used for the image being programed, then program the code with a correct ECC set. The sectors beyond the end of the image will be left unchanged, which keep in “erased” states without ECC set on them.   When LPC55Sxx executes FLASH read code ( for example, mytemp = *(uint32_t*)0x4000 ) through AHB bus, it checks FLASH ECC while AHB read. No issue to read programed sectors because ECC has already set. But, read unprogrammed sectors with invalid ECC values leads to fail to read and go to HardFault_Handler as below: If performing AHB reads of the flash memory contents AFTER a sector erase, we will have the same HardFault issue. Solutions There are two solutions to fix the error. 1. Read FLASH Content after Programing the FLASH Sector Unlike mass erasing, programing FLASH updates the related ECC value. Thus with a successful ECC check, read AHB can be realizable by below code. volatile uint32_t mytemp; …… mytemp = *(uint32_t*)0x1000;//read memory content 0x1000 to mytemp‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ NOTE: 0x1000 MUST be a “programed” address. If the unused FLASH sector is in “erased” state, in order to read it, we need manually program it before AHB read. FLASH programming demo code can be referred in flashiap demo under MCUXpresso SDK package. See function FLASH_Program. 2. Read FLASH Content Using FLASH Controller Command Read operations using FLASH controller commands (See UM11126 Section “Command listing (CMD)”) will not cause hard fault. This is the UM recommended method of read FLASH content. Note: Flash operations (erase, blank check, program) and reading a single word can only be performed for CPU frequencies of up to 100 MHz. These operations cannot be performed for frequencies above 100 MHz. So far I haven’t found a FLASH read demo code. Please follow below steps to create your demos. Environment: IDE: MCUXpresso IDE v11.1.0 SDK MCUXpresso SDK v2.7.0 Steps: See attached document. Thanks for the suggestion from Alex Yang and andybeeson‌
記事全体を表示
This document describes how to create a new LPC project using LPCOpen v2.xx, LPCXpresso v8.2.2 and LPC11U24 LPCXpresso board. In addition describes how to create 2 simple example codes. Blinking LED. Set the LED using a push bottom.  LPCOpen LPCOpen is an extensive collection of free software libraries (drivers and middleware) and example programs that enable developers to create multifunctional products based on LPC microcontrollers. After install LPCXpresso, the LPCOpen packages for supported board(s)/device(s) can be found at the path: <install_path>\lpcxpresso\Examples\LPCOpen > This directory contains a number of LPCOpen software bundles for use with the LPCXpresso IDE and a variety of development boards. Note that LPCOpen bundles are periodically updated, and additional bundles are released. Thus we would always recommend checking the LPCOpen pages to ensure that you are using the latest versions. This example was created using the LPC11U24 LPCXpresso board in this case the drivers selected is lpcopen_v2_00a_lpcxpresso_nxp_lpcxpresso_11u14.zip Importing libraries In order to create a new project, it is necessary to first import the LPCOpen Chip Library for the device used and optionally the LPCOpen Board Library Project. For do that it is necessary to follow these steps: 1. Click on Import project(s). 2. Select the examples archive file to import. In this case, the projects imported are contained within archives .zip.  3. For this example the LPC11U14 LPCXpresso board is selected. Click Open. Then click Next 4. Select only the LPCOpen Chip Library and LPCOpen Board Library Project. Click Finish. The same steps are required for any LPC device and board you are used. Creating a new LPC project.   The steps to create a new LPC project are described below: 1. In Quickstar Panel, click "New project"   2. Choose a wizard for your MCU. In this case LPC1100/LPC1200 -> LPC11Uxx -> LPCOpen-C Project This option will link the C project to LPCOpen. Then click Next.   3. Select the Project name and click Next.   4. Select the device used (LPC11U24 for this case) and click Next.   5. Select the LPCOpen Chip Library and LPCOpen Board Library, these projects must be present in the workspace.   6. You can set the following option as default clicking Next, then click Finish.   7. At this point, a new project was created. This project has a src (source) folder, the src folder contains: cr_startup_lpc11uxx.c: This is the LPC11Uxx Microcontroller Startup code for use with LPCXpresso IDE. crp.c: Source file to create CRP word expected by LPCXpresso IDE linker. sysinit.c: Common SystemInit function for LPC11xx chips. <name of project> my_first_example: This file contains the main code.     8. LPCXpresso creates a simple C project where it is reading the clock settings and update the system core clock variable, initialized the board and set the LED to the state of "On". 9. At this point you should be able to build and debug this project.   Writing my first project using LPCXpresso, LPCOpen and LPC11U24.   This section describes how to create 2 simple example codes. Blinking LED. Set the LED using a push bottom. The LPCOpen Chip Library (in this case lpc_chip_11uxx_lib) contains the drivers for some LPC peripherals. For these examples, we will use the GPIO Driver. The LPCOpen Board Library Project (in this case nxp_lpcxpresso_11u14_board_lib) contains files with software API functions that provide some simple abstracted functions used across multiple LPCOpen board examples. The board_api.h contains common board definitions that are shared across boards and devices. All of these functions do not need to be implemented for a specific board, but if they are implemented, they should use this API standard.   After create a new project using LPCXpresso and LPCOpen, it is created a simple C project where it is initialized the board and set the LED to the state of "On" using the Board_LED_Set function.   int main(void) {   #if defined (__USE_LPCOPEN)     // Read clock settings and update SystemCoreClock variable     SystemCoreClockUpdate(); #if !defined(NO_BOARD_LIB)     // Set up and initialize all required blocks and     // functions related to the board hardware     Board_Init();     // Set the LED to the state of "On"     Board_LED_Set(0, true); #endif #endif       // TODO: insert code here       // 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 ; }       a. Blinking LED. In board_api.h file there is an API function that toggle the LED void Board_LED_Toggle(uint8_t LEDNumber);  LEDNumber parameter is the LED number to change the state. The number of the LED for the LPCXpresso LPC11U24 is 0. It is easy to create a delay function using FOR loops. For example: void Delay (unsigned int ms) {         volatile static int x,y;           while (ms)         {                 for (x=0; x<=140; x++)                 {                         y++;                 }                 ms--;         } } In order to have the LED blinking, it is necessary to call these functions in an infinite loop. while(1) {                 Board_LED_Toggle(0);                 Delay (10000);         } Complete code (Blinking LED). int main(void) { #if defined (__USE_LPCOPEN)         // Read clock settings and update SystemCoreClock variable         SystemCoreClockUpdate(); #if !defined(NO_BOARD_LIB)         // Set up and initialize all required blocks and         // functions related to the board hardware         Board_Init();         // Set the LED to the state of "On"         Board_LED_Set(0, true); #endif #endif          while(1) {                 Board_LED_Toggle(0);                 Delay (10000);         }         return 0 ; }  void Delay (unsigned int ms) {         volatile static int x,y;         while (ms)         {                 for (x=0; x<=140; x++)                 {                         y++;                 }                 ms--;         } }      b. Set the LED using a push bottom. For this example it is necessary to configure a pin as input.  The gpio_11xx_1.h file contains all the function definitions for the GPIO Driver. The example uses the pin 16 of port 0 to connect the push bottom. The function Chip_GPIO_SetPinDIRInput(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin) sets the GPIO direction for a single GPIO pin to an input. In order to configure the Port 0, pin 16 as input we can use this function: Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 16); Then, it is necessary to check the status of this pin to turn-on/turn-off the LED. The function Chip_GPIO_GetPinState(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin) gets a GPIO pin state via the GPIO byte register. This function returns true if the GPIO is high, false if low. State_Input=  Chip_GPIO_GetPinState (LPC_GPIO, 0, 16);   Complete code (Set the LED using a push bottom). int main(void) {         bool State_Input;   #if defined (__USE_LPCOPEN)     // Read clock settings and update SystemCoreClock variable     SystemCoreClockUpdate(); #if !defined(NO_BOARD_LIB)     // Set up and initialize all required blocks and     // functions related to the board hardware     Board_Init();     Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 16);     // Set the LED to the state of "On"     Board_LED_Set(0, false);  #endif  #endif      while(1) {           State_Input=  Chip_GPIO_GetPinState (LPC_GPIO, 0, 16);              if (State_Input==0){                 Board_LED_Set(0, true);             }             else {                 Board_LED_Set(0, false);             }     }     return 0 ; }   I hope this helps!! Regards Soledad
記事全体を表示
This blog posting is an introduction to Capacitive Touch provided for the LPC845 MCU device. We are going to take advantages of the features that the LPC845 Breakout Board to show how to interface with the onboard Cap touch button using SDK drivers.    The Capacitive Touch module measures the change in capacitance of an electrode plate when an earth-ground connected object (for example, the finger or stylus) is brought within close proximity. Simply stated, the module delivers a small charge to an X capacitor (a mutual capacitance touch sensor), then transfers that charge to a larger Y capacitor (the measurement capacitor), and counts the number of iterations necessary for the voltage across the Y capacitor to cross a predetermined threshold.   Figure 1. Mutual Capacitive Touch   A pulse is applied between the transmitting and receiving electrode to generate an electromagnetic field. When a finger comes into close proximity, part of the electromagnetic field moves to the finger where the decrease in electromagnetic field strength is detected by the electrodes. The capacitance is detected and captured and recognized as a finger presence.   LPC845 MCU Capactive Touch Features Up to nine mutual-capacitance touch sensors. Both GPIO port pin and analog comparator measurement methods are available. DMA for continuous sequential polling of all sensors with no CPU intervention. Wake up from sleep, deep-sleep, and power-down modes.   Advantages Cap-touch interfaces can be incorporated into products with curved surfaces allowing for greater design flexibility. No moving parts allow for increased durability and reduce the number of components, thus lowering overall costs. Provides a smooth, sleek appearance without raised surfaces or button openings allowing for ease of cleaning and sealed designs. Can be a complete plug-and-play interface or simply a graphic bonded to a cap-touch circuit that interfaces with the microcontroller.   Pin usage The Capacitive Touch module uses one standard GPIO pin for YL and up to nine standard GPIOs for X0 through XMAX.    YH, YL, and X functions are typically enabled on their pins using the switch matrix or IOCON, depending on the product family. Additionally, the set of X pins that the application will use must be enabled or identified to the module by writing ‘1’s to their bit positions in the XPINSEL field of the control register.   Registers Programming of all these registers is performed only during initialization.   Table 1. Capacitive Touch Registers. Capacitive Touch with the LPC845 Breakout Board.   The LPC845 Breakout Board include an on-board Cap Touch button that enables easy evaluation of the capacitive touch features of the LPC84x family of devices.   The connections for the capacitive touch button are shown in Table 2 below. If the Cap Touch button is not being used, the ports connected to it can be used for other purposes (such as GPIO), but note that PIO0_30 and PIO0_31 are effectively shorted together through resistor R19. If this zero ohm resistor may be removed if the Cap Touch button is not required.   Table 2. Capacitive touch button signals   Capacitive Touch Example    What we need: LPC845 Breakout Board MCUXpresso IDE V10.3.0 SDK_2.5.0_LPC845 NXP example packages Micro USB cable   The NXP example package includes projects to use the principal's peripherals that the board includes: ADC, I2C, PWM, USART, Captouch, and SPI. We are going to use the Captouch example include here, this after an initial calibration, once the cap touch button is touched, the RGB's Red led will turn on.   Once downloaded, we import the library project into the workspace using the ''Import project(s) from file system... from the Quickstart panel in MCUXpresso IDE:   Figure 2. Import Projects.   Then browse the examples packages archive file:   Figure 3. Select Example Package.   Press next, and see that are a selection of projects to import, in this case, only keep select the LPC845_BoB_CAPTouch how it looks in the picture below:   Figure 4. Select CapTouch Project   Now with the project in the workspace, we are going to build and run the example, you are going to see instructions in the IDE console for the calibration. Put your finger in the captouch button and press enter to start the calibration, once finished, you are going to see a message, and with that the demo is ready, you are going to see the RGB red led on when the when the cap touch button is touched and off then it´s not.
記事全体を表示
lpc‌ feature‌ sct‌ Attached doc is the LPC MCU Serial SCT feature introduction and application Contents Timer/State machine basics SCT introduction SCT availability SCT tools & resources SCT application analysis
記事全体を表示
This document explains how to create a new project using MCUXpresso IDE for a LPCXpresso1549 board. There is important to mention that there is no SDK for LPC15xx device family so we are using LPCOpen libraries.   MCUXpresso IDE introduction   MCUXpresso IDE is based on the Eclipse IDE and includes the industry standard ARM GNU toolchain. It brings developers an easy-to-use and unlimited code size development environment for NXP MCUs based on Cortex-M cores (LPC and Kinetis). MCUXpresso IDE debug connections support Freedom, Tower®, LPCXpresso and your custom development boards with industry- leading open-source and commercial debug probes including LPC-Link2, P&E and SEGGER. The fully featured debugger supports both SWD and JTAG debugging, and features direct download to on-chip flash. When MCUXpresso IDE is installed, it will contain pre-installed part support for most LPC based MCUs. Example code for these pre-installed parts is provided by sophisticated LPCOpen packages (and Code Bundles). Each of these contains code libraries to support the MCU features, LPCXpresso boards (and some other popular ones), plus a large number of code examples and drivers.   In addition, MCUXpresso IDE’s part support can be extended using freely available MCUXpresso SDK2.x packages. These can be installed via a simple ‘drag and drop’ and automatically extend the IDE with new part knowledge and examples. SDKs for MCUXpresso IDE can be generated and downloaded as required using the SDK Builder on the MCUXpresso Config Tools website at: http://mcuxpresso.nxp.com/   Create a new project   For this document, we are using the LPCXpresso1549 board (for this MCU an LPCOpen project exists), however the process is the same for any LPCXpresso board. It is necessary to download the LPCOpen bundle for your target MCU/board and import it into your Workspace, LPCOpen is available in the next link:  http://www.nxp.com/lpcopen Select “New project” in the QuickStart panel, this will open a new window   Select the desire board. For this case, we are using the LPCXpresso1549, and click “Next” NOTE: When the board is selected, you can see highlighted in the above figure that the matching MCU (part) is selected automatically. If no matching board is available, the required MCU can be selected from the list of Pre-Installed MCUs. The MCUXpresso IDE includes many project templates to allow the rapid creation of correctly configured projects for specific MCUs. This New Project wizard supports 2 types of projects: Those targeting LPCOpen libraries Standalone projects In this case, we will show the steps in creating a LPCOpen- Cproject. This option creates a simple C project, with the main() routine consisting of an infinite while(1) loop that increments a counter. In additions, code will also be included to initialize the board and enable a LED. Select the project name and click “Next” When creating an LPCOpen-based project, the first option page that you will see is the LPCOpen library selection page. It is necessary import the LPCOpen Chip Library for the device used and optionally the LPCOpen Board Library Project, the below window allows to import the libraries if you have not already done so. Follow the below steps: a. Click on “Import…”, a new window will appear, select the archive file to import. In this case, the projects imported are contained within archives .zip. For this example, the LPCXpresso1549 board is selected. Click “Open”. Then click “Next” b. Select only the LPCOpen Chip Library and LPCOpen Board Library Project. Click “Finish” Select LPCOpen Libraries. Click “Next” Select CMSIS Library project. The CMSIS library option within the MCUXpresso IDE allows you to select which (if any) CMSISCORE library you want to link to from the project you are creating. For this case we selected “None” as default. Click “Next” NOTE: The use of LPCOpen instead of CMSIS-CORE library projects is recommended in most cases for new projects. Enable SWO trace clock. Click “Next” Enable linker support for CRP. Click “Next” The “Semihosting C Project” wizard for some parts provides two options for configuring the implementation of printf family functions that will get pulled in from the Redlib C library: Use non-floating-point version of printf If your application does not pass floating point numbers to printf() family functions, you can select a non-floating-point variant of printf. This will help to reduce the code size of your application. For MCUs where the wizard does not provide this option, you can cause the same effect by adding the symbol CR_INTEGER_PRINTF to the project properties. Use character- rather than string-based printf By default printf() and puts() make use of malloc() to provide a temporary buffer on the heap in order to generate the string to be displayed. Enable this option to switch to using “character-by-character” versions of these functions (which do not require additional heap space). This can be useful, for example, if you are retargeting printf() to write out over a UART – since in this case it is pointless creating a temporary buffer to store the whole string, only to print it out over the UART one character at a time. For MCUs where the wizard does not provide this option, you can cause the same effect by adding the symbol CR_PRINTF_CHAR to the project properties. For this example we will maintain as default. Having selected the appropriate options, you can then click on the Finish button, and the wizard will create your project for you, together with appropriate startup code and a simple main.c file. At this point you should be able to build and debug this project Writing my first project The LPCOpen Chip Library (in this case lpc_chip_15xx) contains the drivers for some LPC peripherals. For these examples, we will use the GPIO Driver. The LPCOpen Board Library Project (in this case lpc_board_nxp_lpcxpresso_1549) contains files with software API functions that provide some simple abstracted functions used across multiple LPCOpen board examples. The board_api.h contains common board definitions that are shared across boards and devices. All of these functions do not need to be implemented for a specific board, but if they are implemented, they should use this API standard. After create a new project using MCUXpresso and LPCOpen, it is created a simple C project where it is initialized the board and set the LED to the state of "On" using the Board_LED_Set function. In this example, we will toggle the a LED using a push bottom. In LPCXpresso1549 board le LEDs are connected to PIO1.1, PIO0.3 and PIO0.25 pins. And the SW1 to PIO0.17 pin. The function Chip_GPIO_SetPinDIRInput configures a pin as input.  The function Chip_GPIO_GetPinState gets a GPIO pin state via the GPIO byte register. The function Board_LED_Set set the LED to the state of "On" or “Off”.. Complete code (Set the LED using a push bottom).   /* ===============================================================================  Name        : LPCXpresso_new_example.c  Author      : $(author)  Version     :  Copyright   : $(copyright)  Description : main definition ===============================================================================  */   #if defined (__USE_LPCOPEN) #if defined(NO_BOARD_LIB) #include "chip.h" #else #include "board.h" #endif #endif   #include <cr_section_macros.h>     int main(void) {         bool State_Input;  #if defined (__USE_LPCOPEN)        // Read clock settings and update SystemCoreClock variable        SystemCoreClockUpdate();  #if !defined(NO_BOARD_LIB)        // Set up and initialize all required blocks and        // functions related to the board hardware        Board_Init();        Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 17); //Set GPIO direction for a single GPIO pin to an input   #endif #endif          while(1) {                State_Input=  Chip_GPIO_GetPinState (LPC_GPIO, 0, 17);  //Get a GPIO pin state via the GPIO byte register                if (State_Input==0){                       Board_LED_Set(0, true); // Set the LED to the state of "On"                }                else  {                       Board_LED_Set(0, false); // Set the LED to the state of "Off"                }        }        return 0 ; }  
記事全体を表示
This cook book includes lots of interesting examples leveraging LPC MCU's powerful SCT Timer. Have fun using them, creating more and sharing more. #sct‌
記事全体を表示
Now that you've downloaded & unzipped your LPCXpresso54608 SDK, let's open KEIL uVision IDE. Note: you must have at least uVision version 5.22.0.0 to use this board Before we start utilizing uVision we must make sure that we have the relevant packs installed to work with the LPCXpresso54608 board. Select the Pack Installer on the toolbar. The Pack installer shows you which parts and boards for which you have support. On the left hand side you see a variety of different manufacturers. The easiest way to search will be to type 'lpc' into the search right below the devices tab. Then select 'LPC54000 Series'. On the right hand side under the packs tab you will see one item listed under 'Device Specific' called 'Keil::LPC54000_DFP' click on install Note: Version 2.1.0 released on 10-18-2016 added LPC5460x support. If you had downloaded this pack before go to Packs>Check for Updates at the top to download the latest version Once installed the diamond will turn green. To double check we are ready, select boards on the left side and search  'lpcxpresso54'. You will notice that our board is green indicating we have support for it in uVision. Now we can close the Pack Installer to return to uVision Select File>Open and navigate to the location you unzipped your SDK download.  By the way, within this folder there are plenty of SDK based demos for you to explore our microcontroller.  We will use one of them to guide you through this tutorial, but definitely take time to try all of them! Navigate to boards>lpcxpresso54608>demo_apps>touch_cursor>mdk, change file type to ''Project Files (*.uvproj, *.uvprojx) and select 'touch_cursor' Once opened, select 'Build' right above the Project window. Once the Build Output window tells you that you have successfully built the program select the 'Start/Stop Debug Session' icon. Note: You may receive a warning if you have a size limitation on the license you are using. If you do get a warning you can resolve licensing issues by going to File>License Management. Once the debug session has been started select 'Run' on the left side Once you have successfully flashed the board with this demo you will see the following, This demo utilizes the touch interface on the screen to read where you are touching and updates the cursor position to the last known location.   Remember that other demos and sample code are provided in the root folder of the SDK download.   Be sure to explore these demos and reach out on the community if you need help!
記事全体を表示
Recently I found some customers have a bit of problem when porting project from one MCU to another, so this article using simple steps demonstrates how to change MCU with MCUXpresso. There is also a video demonstrated the detail steps in attachment. Pay attention, as MCUXpresso User Guide says: All projects are associated with a particular MCU at creation time. The target MCU determines the project memory layout, startup code, LinkServer flash driver, libraries, supporting sources,launch configuration options etc. etc. so changing a project’s associated MCU should not be undertaken unless you have a total grasp of the consequence of this change. Therefore rather than changing a project’s associated MCU, it is strongly recommended that instead a new project is generated for the desired MCU and this new project is edited as required. However, on occasion it may be expedient to reset a project’s MCU (and associated SDK) and this can be achieved as follows. For example, changing lpc55s69 to lpc55s06, we need install SDKs for lpc55s69 and lpc55s06 before all the below steps. 1 - Change MCU & Package 1.1 – Change MCU Right click “MCU” under Project tree, choose “Edit MCU” Uncheck ”Preserve memory configuration”(it is checked by default)->choose LPC55S06->there is a warning, choose Yes. We can see the Memory details changed to lpc55s06, then click ”Apply and close”. 1.2 – Change Package 2 - Change Compiler Definitions In Properties view->Settings->MCU Compiler ->Preprocessor, change the definition for CPU from LPC55S69JBD100 to LPC55S06JBD64 as below: 3 – Change/add SDK driver for LPC55s06 Selected project, then click ”Manage SDK components”, choose the drivers our application used, for example, clock, power, usart. Click “OK”, then click “Yes” to update. Delete LPC55S69 device related files: Add “system_LPC55S06.c” and “system_LPC55S06.h” files: 4 - Change startup file. Delete LPC55s69 startup files, add “startup_lpc55s06.c”, we can find the startup file in any SDK demo. 5 - Change board related files. Refer to our own new board, change files under “board” folder, for example pins, uart number, here directly copy from SDK demo for LPCxpresso55s06 board. 6 - Test the project  function with new board Build project until no compile error, download and run it, result as below.        
記事全体を表示
Unboxing of the Mini-Monkey.    This was a demonstration of how you can use a low cost 2-layer PCB process with the LP55S69 in the 0.5mm pitch VFBGA98 package.    We used Macrofab for the prototypes and the results were fabulous. Blog articles on the Mini-Monkey: https://community.nxp.com/community/general-purpose-mcus/lpc/blog/2020/03/13/mini-monkey-part-1-how-to-design-with-the-lpc55s69-in-the-vfbga98-package https://community.nxp.com/community/general-purpose-mcus/lpc/blog/2020/03/29/mini-monkey-part-2-using-mcuxpresso-to-accelerate-the-pcb-design-process https://community.nxp.com/community/general-purpose-mcus/lpc/blog/2020/04/19/lpc55s69-mini-monkey-build-update-off-to-fabrication
記事全体を表示
This article mainly introduces how to config CTIMER match 3 trigger ADC in LPC804, includes how to config related registers, and the code under SDK. Other LPC serials, also can refer to this DOC. 1.How To Configure ADC Part. 2.How to Configure CTIMER Part 3.Project Basic Information 4.Reference   Project is attached, it base on MCUXpresso IDE v11.1.1,  LPCXpresso804 board.  
記事全体を表示
ADCHS and DAC programming with LPC-Link 2 + LabTool Dirceu Rodrigues, Jr. - Oct. 2013 Bio Dirceu Rodrigues, Jr. is a computer engineer with a master's degree in electrical engineering. As an independent consultant, he tests new products with particular interest in the areas of wireless sensor networks, ARM processors, DSP, motor control, and medical applications. Introduction             When I got involved with this campaign, my initial idea was to use the NXP LPC4370 microcontroller available on the LPC-Link 2 to implement a multicore FIR filter. Combined with the analog processing capabilities present on LabTool add-on board, would be ideal to put in place a structure which I discussed on ESC Brazil 2013 (Multicore Microcontrollers in Instrumentation and Control). But after a time studying the schematics of these boards, I realized that understanding the signal conditioning circuits, gain settings, input calibration and the correct use of ADCHS (12 bit High Speed ​​ADC) peripheral and external DAC, deserve a whole article. For me, the most important feature of the board LPC-Link 2 (in addition to being a programmer/debugger for the target) is able to program a generic application on LPC4370 memory, since there are several analog/digital pins available on expansion connectors.                 Firstly, I downloaded the latest version of the ARM Keil µVision (V4.72.10.0). At time, I had not experienced the new LPCOpen library, so I changed the LPC43xx.h provided by the compiler to add a raw support for ADCHS peripheral - renaming it to LPC43xx_new.h. The change consists primarily in define register addresses, enabling references such as “LPC_ADCHS->xxx”. Before attach LPC-Link 2 on top of LabTool board, I connected the 10 pin SWD cable on J2 of LPC-Link 2, according Figure 1. Will look like the cable is squeezed between the boards, but that is quite normal. Also, the user must to ensure the other connectors are not slightly misaligned. LabTool - Analog Inputs Next I tried to unveil the structure around the high speed analog to digital converter.  The reason for the presence of the BNC connectors on LabTool is to implement a complete two channel oscilloscope, whose features are far from modest, since the LPC4370 includes a 12 bit ADC, and can operate up to 80 MHz. Note that the two 10 bit ADC modules are absent on LPC4370 TFBGA100 package used in LabTool. A very simplified schematic of input conditioning circuit for each channel is shown on Figure 2. The complete design, provided by Embedded Artists[1], includes several other components, including capacitors for shaping the frequency response. All settings are controlled via the SPI interface, including the DC/AC coupling. The input  (0.5 V) is provided by a proper MCU pin related to ADCHS, as I will explain later. Two analog multiplexers allow set the gain when changing the operational amplifier feedback resistor.  From the nominal values of components on figure, we can write some equations for the DC model: The LPC4370 ADC is a flash type with differential input - Figure 3. The value converted to digital domain, as presented on page 1287 of LPC43xx User Manual (2013 draft version), is: Through the DCINNEG and DCINPOS bits on ADCHS POWER_CONTROL register, the user can add a 0.5 V DC offset to the differential inputs. In the case of Labtool board, is convenient make DCINNEG = 1 and DCINPOS = 0, considering the presence of amp op with the non-inverting input voltage according Figure 2. With these settings: and . Also, note that Substituting these results on Eq. 4:  , and: Defining:  The value of G A depends on position of two multiplexers (feedback resistor selection 1 out 😎 and SPDT switch (divided input voltage selection V U or V D ).  So, I can create the Table 1, which allow me to calculate the analog input value or V CH1 , for each selection. Feedback resistance Non-inverting Amp. Op. gain GA VCH1 2k87 // 158R 2 0.4 2k87 // 536R 4 0.8 2k87 // 1k65 8 1.6 2k87 20 4 0R 1 0.016 1k33 // 270R 2.5 0.04 1k33 // 1k07 5 (4.95) 0.08 1k33 10 ( 9.86) 0.16 In order to obtain a value of acceptable precision it's required to compensate the ADC readings (N ADC ) for component tolerances and other deviations associated with the input conditioning circuit. This is done in software. An affine function (gain and offset) makes the correction based on the current reading and previous calibration data – Listing 1. Remember that a measuring instrument is not only as good as its components, but also as the calibration method used. LabTool - Analog Outputs The Digital to Analog section is more straightforward. Since the 10 bit DAC module is absent on LPC4370 TFBGA100 package, the LabTool board relies on external DAC102S085 from National to output two analog voltages. As before, the simpler schematic on Figure 4 shows the essential components for the DC model. On LabTool board, the LPC4370 SSP1 peripheral has three usages: Settings for the ADCHS conditioning circuit. Writing on DAC Communication with an EEPROM The sharing is carried out through appropriate slave selection signals (SSEL and GPIOs) from MCU. The DAC has two channels with internal data register including controls for update/refresh timing. The relevant equations are: Substituting Eq. 7 in Eq. 8: Application: Filtering an ECG In order to test the ADCHS and related equations obtained from the LabTool manufacturer schematics, I decided to program the ARM Cortex-M4 on LPC4370 to implement a stop-band FIR (Finite Impulse Response) filter with 127 taps. The idea is to filter an ECG signal corrupted by 60 Hz hum. To avoid building a circuit around an instrumentation amplifier (something I've done a few times) and waste some skin electrodes; I thought using the computer sound card to generate the desired signal. So, the following tasks were performed: Find an ECG signal database in audio format [2]. Select the file ecg.wav (60s duration, 16 bit, 1 kSa/s). Extract the file data on Matlab, insert a 60 Hz noise and rewrite it in wav format . Play the file on computer line-out using a software for audio editing like GoldWave. This will allow some experimentation, as repeat intervals, invert polarity, attenuate and many other useful transformations - Figure 6. Design a notch FIR filter in Matlab and simulate the result. Make a header file with the generated 127 coefficients. For this application, I used DC coupling on input (capacitor short-circuited on Figure 2). Also, the ADCHS was configured to present the result in two’s complement format (other option is offset binary) . Figure 7 shows a diagram for the FIR filter - coefficients and output labeled as c and NFILT, respectively. To check the result, the filtered signal is sent to the analog output in real time. For this it’s necessary to perform a conversion between the ADCHS and DAC102S085 ranges using appropriate equations. Here I have at least two options: 1. Taking advantage of maximum available resolution (not used): In this case, the conversion is performed through the Equation 10 and Figure 8.  Substituting Eq. 10 on Eq. 9:  In order to ensure compatibility with the amplitude of sound card output it is appropriate to select the gain 10 for the ADC non-inverting amplifier (last row of Table 1).  Therefore, the equation for the analog to digital conversion is:  This leads to a maximum input voltage around +/- 2.5V, when -2048 <= NFILT < +2048.  Combining Eq.11 and Eq. 12, the relationship b etween input and output is given by:  2. Equal amplitudes (input/output): In the ECG filtering applicatioon it is desirable that the original and filtered signals had the same amplitude, or a 1:1 relationship. Therefore, I've carried a different conversion in order to meet VEXT_AOUT1 = VCH1.  Still maintaining the gain 10 between VCH1 and NFILT and equating Eq. 12 and Eq. 9:  Thus resulting in the equation responsible for the conversion:  Armed wiht this modeling I did a simulation on Matlab.  The plots on Figure 9 allowed me to check the filter performance by comparing the input, the noisy signal and the output.  Note an approximate delay of 64ms between the input and output (representing taps/2 samples). With this set of equations and the FIR itself coded on LPC4370, the final result is shown following. The sampling and output rates both are equal to 1k/s. Note an approximate delay of 64 ms between input and output (representing taps/2 samples). This powerful microcontroller and its high speed ADC are able to handle sample rates much higher than the one I used here, including multichannel audio. As I mentioned earlier, the purpose of this simple application is just to introduce the analog resources available on LabTool board. Conclusion The ADCHS has many other configuration options. It works through a state machine with a dedicated timer and a set of eight descriptors, for which it is possible to establish how and when a conversion occurs, generating interrupts, filling a 16 position FIFO or transferring data through DMA The clock for this application was adjusted to 180 MHz, a value more than sufficient. In a next installment, I intend to wake-up the other two Cortex-M0 cores on the LPC4370, implementing a truly multicore filter through IPC (Inter-process Communication), running at a lower clock; something like 60 MHz and compare the results with the single core solution – for example, analyzing the power consumption. Stay tuned [3]. References [1] http://www.embeddedartists.com [2] http://courses.engr.illinois.edu/bioe415/labs/ecgwav.html [3] http://www.youtube.com/DirceuRodriguesJr
記事全体を表示
lpc‌ feature‌ spifi‌ Attached doc is the LPC MCU Serial SPIFI feature introduction and application Topics • SPIFI introduction • SPIFI performance • SPIFI debug • SPIFI library • Introduction to SPIFI flash content protection
記事全体を表示
Hi: Since LPC series ADC has sequence function, so implement multi-channel ADC transfer is easy. But use DMA is also meaning, so there are two demos to show how to use such applications 1.lpc_multi-channels_adc_dma_sw_trg Use SW trigger multi channels ADC transfer, but use DMA to transfer result to result array. use don't need to care the channel result register, but fetch data from global data register; 2.lpc_multi-channels_adc_dma_hw_trg for many cases, user need to trigger ADC multi channels transfer periodly, and collect enough data for processing. so this demo use SCT_OUT7 to trigger ADC Sequence A for 6 channels, then after 1024 rounds, generate DMA interrupt to process all 6*1024 data array. all demos are implemented on SDK2.6.0 
記事全体を表示
Hello Community! This document is provided as a hands-on lab guide.  The intent of the lab is to demonstrate how to program and use the LPC8N04 development board by using the LPC8N04 board support package demo application and make use of the read, write and energy harvesting capabilities of the NFC tag. Setup The following items are needed to complete the lab: Software: •    LPC8N04 Board Support Package MCUXpresso, can be downloaded at this link: https://www.nxp.com/downloads/en/lab-test-software/LPC8N04-MCUXpresso-BSP.zip •    MCUXpresso IDE version 10.2.1, can be installed from here: https://www.nxp.com/mcuxpresso/ide •    LPC8N04 NFC Demo Android application, can be installed at the link below: https://play.google.com/store/apps/details?id=com.nxp.lpc8nxxnfcdemo   Hardware: •    LPC8N04 Development Board for LPC8N04 MCU (OM40002): https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc800-series-cortex-m0-plus-mcus/lpc8n04-development-board-for-lpc8n04-mcu:OM40002 •    Android Phone with NFC •    1 Micro USB cable   Hope this guide is helpful! Any comments are welcome.   Best Regards, Carlos Mendoza Technical Support Engineer
記事全体を表示
    Writing this post just want to remind the customer of RAM allocation when use the on-chip CAN drivers in LPC11C24. Otherwise, when meet the abnormal issues, it is difficult to locate the root reason and it also causes a waste of time.      Now, take a real customer question as an example, to highlight the RAM allocation importance when using the on-chip CAN API in LPC11C24. Problem description     Customer used the LPC11C24 on-chip CAN API to realize the CAN frames sending and receiving, the CAN code was from the official lpcopen, and it worked OK when he just used the CAN code. But when customer added the UART code, they found the code always enter hardfault after a short time running. They test the UART code which without the CAN code directly, the UART code worked perfectly. It means, independent UART code and independent CAN code are all working normally, but when combine the UART and on-chip CAN code together, the code will enter hardfault. Problem analysis From the Cortex M0 devices generic user guide, we can get the information about the hard fault:     Faults are a subset of exceptions, see Exception model. All faults result in the HardFault exception being taken or cause lockup if they occur in the NMI or HardFault handler. The faults are:      execution of an SVC instruction at a priority equal or higher than SVCall      execution of a BKPT instruction without a debugger attached      a system-generated bus error on a load or store      execution of an instruction from an XN memory address      execution of an instruction from a location for which the system generates a bus fault      a system-generated bus error on a vector fetch      execution of an Undefined instruction      execution of an instruction when not in Thumb-State as a result of the T-bit being previously cleared to 0      an attempted load or store to an unaligned address Now we debug the problem project to check, which detail code line caused this hardfault problem. When the code enters the hardfault handler, check the MSP address in the flash, then find the LR register, which will link to the code before entering in the hardfault handler, the following are the according debug result:   The LR register is 0X1FFF2C1F, it means before enter in hardfault handler, the code runs to this address code. Now, check the 0X1FFF2C1F in the memory map.    We can find the address is in the ROM area, because we just use the ROM CAN driver, UART is just the pure register control code, then we can get the problem still relate to the on-chip CAN driver, not the UART code. But we can’t see or debug the detail ROM CAN driver directly, we still can’t find the root problem.    Even we know the problem is not caused by the UART, but another important clue which relates to the UART function also influence the test result after I do a lot of testing. In the customer code, he defines the UART user transmit and receive buffer like this: #define UART_SRB_SIZE 128    // Send #define UART_RRB_SIZE 32    // Receive /* Transmit and receive buffers */ static uint8_t rxbuff[UART_RRB_SIZE], txbuff[UART_SRB_SIZE];   On one occasion, I tried changing #define UART_SRB_SIZE 128 To  #define UART_SRB_SIZE 32 Just minimize the txbuff size, I found the code won’t enter in the hardfault handler any more. It seems very strange and contradiction with the hardfault handler enter point which is test before.    I also check the generated code size, the used RAM and flash size is:   text       data        bss        dec        hex    filename    7672          0        244       7916       1eec    pscan.axf LPC11C24 RAM is 8K, here just 244 Bytes, the stack also use the whole RAM, so the 8K RAM size should be enough to use.   In this situation, I check the project’s .map file about the txbuff with 128 and 32 respectively.    1)txbuff with 128Bytes Rxbuff and txbuff occupy the RAM address from 0X10000048 to 0X100000E8.     2)txbuff with 32Bytes Rxbuff and txbuff occupy the RAM address from 0X10000048 to 0X10000088. We can find the txbuff start address is the same, just the end address has difference.    With these information, we checked the LPC11C24 user manual chapter C_CAN on-chip drivers again, we found a significant description:      0X10000050 to 0X100000B8 is used by the on-chip CAN API RAM, and from the issue project, memory map file, we can find rxbuff and txbuff RAM address is 0X10000048 to 0X100000E8, it already occupies the whole CAN API RAM, this is the key point. Minimize the txbuff, then rxbuff and txbuff occupy the RAM address from 0X10000048 to 0X10000088, this address doesn’t occupy the whole on chip CAN API RAM, in this situation, the problem doesn’t happen, I think the used CAN API may in the RAM address 0X10000089-0X100000B8.    Anyway, just minimize the buffer size can’t solve the problem from the root side. We must follow the user manual to keep the RAM address from 0x10000050 to 0x100000b8 won’t be used by any other application code.   Problem solutions      From the above chapter, we can find the root problem is the application code occupies the on-chip CAN RAM, to solve the problem, we need to modify the linker file, to prevent the usage of on-chip CAN RAM range.      Because the customer is using the LPCXPresso IDE, then we take this IDE as an example, to protect the RAM address 0x10000050 to 0x100000b8. From the above, we can get that the LPCX11C24 have 8Kbytes RAM, normally, customer will define it just in one, now we divide the RAM to two pieces. 1) RAM2: Location 0X10000000, size 0X100 2) RAM: Location 0X10000100, size 0X1F00 In the LPCXpresso, Project Properties -> C/C++ Build -> MCU settings, then modify it like this:     Then generate the code, and check the map file again.   RAM address from 0x10000000 to 0X10000FF is not used by any other application code. All the application code RAM is using from address 0x10000100. After long time testing, we find the hardfault problem never happens, on customer side, it also works OK. In conclusion, when customer want to use the on-chip CAN API, they need to protect the RAM address from 0x10000050 to 0x100000b8 in the linker file.    
記事全体を表示