LPC微控制器知识库

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC Microcontrollers Knowledge Base

讨论

排序依据:
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.
查看全文
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
查看全文
Hello Community! This document is provided as a hands-on lab guide.  The intent of the lab is to demonstrate how to program the LPCXpresso804 board with the MCUXpresso IDE making use of the SDK examples and the PLU module drivers. The PLU configuration tool will be used to create a new schematic design that will be programmed to the PLU. Setup The following items need to be installed on your computer to complete the lab: Software: •    SDK_2.4.1_LPCXpresso804: -    Copy link into browser: https://mcuxpresso.nxp.com/en/select?device=LPCXpresso804 -    Select ‘MCUXpresso IDE’ or ‘All Toolchains’ in the Toolchain IDE drop-down -    Select ‘Download SDK’ •    MCUXpresso IDE version 10.2.1: -    Can be installed at following link: https://www.nxp.com/mcuxpresso/ide •    PLU configuration tool -    Can be installed at this link: https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/i.mx-applications-processors/i.mx-rt-series/i.mx-rt1060-crossover-processor-with-arm-cortex-m7-core:i.MX-RT1060?tab=Design_Tools_Tab   Hardware: •    LPCXpresso804 Development Board (OM40001): https://www.nxp.com/support/developer-resources/evaluation-and-development-boards/lpcxpresso-boards/lpcxpresso804-for-the-lpc804-family-of-mcus:OM40001?tab=Design_Tools_Tab •    PLU Shield Board •    1 Micro USB cable Hope this guide is helpful! Any comments are welcome. Best Regards, Carlos Mendoza Technical Support Engineer
查看全文
In this document, I will explain how to create a project to use the SPIFI library version 1.03 with the LPC4370. For this we will need the following tools: MCUXpresso IDE 10.2. Link LPC-LINK2 to use it as an evaluation board for the LPC4370. Link External debugger. In my case, I used another LPC-LINK2 board. LPCOpen v2_12 for the LPC4370, this version comes with the installation of MCUXpresso IDE. SPIFI library v1.3. Link Code Example lpcopen_2_12_lpcxpresso_ngx_xplorer_1830_SPIFI_v1.0. Link First, download and install all the tools needed. In your workspace of MCUXpresso we will import (1) three projects of the LPCOpen v2_12 for the LPC4370: periph_blinky, lpc_board_nxp_lpclink2_4370 and lpc_chip_43xx.  The LPCOpen zip file is in the next path of your PC: C:\nxp\MCUXpressoIDE_10.2.1_795\ide\Examples\LPCOpen (2) Extract the files of the zip named lpclibspifi_lpcxpresso_1.03_68 that we downloaded before. The folder that we need is spifilib_m4f. Drag and drop this folder into the Project Explorer on your workspace of the LPC4370, after choosing copy and you should see the spifilib_m4f in your Project Explorer. Once you imported correctly the SPIFI library, select the library (1) on the project explorer window and build it (2). Once you do this you should see that a new folder called Debug appear (3). Now we need to edit the properties of the periph_blinky example to add the library spifilib_m4f to the project. To do this, right click on the project and click properties. Once in the properties window click on C/C++ Build (1) > Settings (2) > Includes (under the section MCU C Compiler) (3). In the includes window click Add… (1) > Workspace (2) > spifilib_m4f (3) > inc (4) > click OK (5) on the window Folder Selection > click OK (6) on the window Add directory path. You should see the following on the include paths. Now, go to the libraries (1) option under the section MCU Linker, on the section Libraries (-I) click Add… (2) finally write the name of the library (spifilib_m4f) (3) and click OK (4). Under the section Library search path (-L) click Add… (1) > Workspace (2) > spifilib_m4f (3) > Debug (4) > OK (5). If you see the same as shown in the below image you are good to go so click Apply and close. To check if you did the below steps correct let’s do the following. On the project periph_blinky in the file systick.c include the file spifilib_api.h and compile the project. If the project compiles without problems it means that you imported correctly the spifi library. If you found problems please stop and repeat all the steps mentioned before. Now that we added successfully the library we can start to migrate the example for the LPC1830 that we download before. First, unzip the file lpcopen_2_12_lpcxpresso_ngx_xplorer_1830_SPIFI_v1.0. Once you unzipped the file go to the following path: spifilib_blinky > example > src. Open the file named Blinky.c and copy all the content of the file. Now go to the file systick.c on your workspace of MCUXpresso within the project periph_blinky, delete all the content of this file and paste what you copied before. Do not compile at this point or you will receive multiple errors! Go back to the path spifilib_blinky > example > src on your PC. Drag and drop the file called spifi_setup.c into the folder src of your project periph_blinky on your Workspace. Open the file that we just copy into our workspace and go to line 46 of the code. Here we are creating a buffer of 64KB that we will use later to write in the SPIFI. The __BSS(RAM3) is to save this buffer in the RAM block three of memory. The problem here is that the block of RAM3 in the LPC4370 is not big enough to store the buffer of 64KB (see below image), so let’s change this for either RAM or RAM2 that are big enough to store the buffer. Now that we added the spifi_setup file let’s go back to the systick.c file and add the external declaration for the function spifiSetUp. At this point, if we compile the project we shouldn’t see any problems, only some warnings because of the functions and variables that we are not using. We are almost done, we are missing the most important thing. With this demo you will be writing, deleting and reading the SPIFI memory, this means that you cannot be executing form the SPIFI flash memory. You need to move to the RAM memory all the functions that are going to make this. This is the reason why in the file systick.c we don’t have any function that interacts directly with the SPIFI, this will make much easier the work of moving all the functions that interact with the SPIFI memory to RAM. The function spifiSetUp is the one that will make all the tests on the SPIFI and it is in the spifi_setup file, so we will need to move this entire file to RAM along with the SPIFI library. We will use three different scripts to move the library and the file spifi_setup to RAM. You can learn more about this in the following community post: https://community.nxp.com/thread/389110. First, right click on the folder of the project > new > folder, the name of the folder must be linkscripts. According to the sections Relocating particular objects into RAM and Relocating particular libraries into RAM of the community post mentioned before we need to create three files in this new folder: main_text.ldt, main_rodata.ldt and main_data.ldt. To do this, right click on the folder linkscripts > new > file. Here is the content that you should have on the three files that we just created. Do not include on the files the text that is in bold, that's just for reference! File main_data.ldt *libspifilib_m4f.a:(.text*) *libspifilib_m4f.a:(.rodata .rodata.* .constdata .constdata.*) *spifi_setup.o(.text*) *spifi_setup.o(.rodata .rodata.* .constdata .constdata.*) . = ALIGN(${text_align}); *(.data*) File main_rodata.ldt *(EXCLUDE_FILE(*libspifilib_m4f.a: *spifi_setup.o) .rodata) *(EXCLUDE_FILE(*libspifilib_m4f.a: *spifi_setup.o) .rodata.*) *(EXCLUDE_FILE(*libspifilib_m4f.a: *spifi_setup.o) .constdata) *(EXCLUDE_FILE(*libspifilib_m4f.a: *spifi_setup.o) .constdata.*) . = ALIGN(${text_align}); File main_text.ldt *(EXCLUDE_FILE(*libspifilib_m4f.a: *spifi_setup.o) .text*) After finishing with the three files you are done with the demo! It’s important to mention that if you want to go inside the function spifiSetUp while debugging you need to set a breakpoint inside the function. While debugging we can see that before calling the function spifiSetUp we are running from the SPIFI flash memory and once we enter to the function we are running from RAM memory. Once we run the demo successfully we should see the following in a terminal and the LED1 will be blinking. Hope this guide is helpful! Best Regards, Victor.
查看全文
This document is an introduction to the Programmable Logic Unit (PLU) provided for the LPC804 MCU device. PLU is used to create small combinatorial and/or sequential logic networks including simple state machines. This allows to replace external components like the 74xx series, which are used for the glue logic with the microcontroller and external devices, making simple the PCB and saving design costs. Figure 1. LPC80x MCU families The PLU is comprised of an array of 26 inter-connectable, 5-input Look-up Table (LUT) elements, and 4 flip-flops.  Each LUT element contains a 32-bit truth table (look-up table) register and a 32:1 multiplexer. During operation, the five LUT inputs control the select lines of the multiplexer. This structure allows any desired logical combination of the five LUT inputs. Figure 2. PLU Features The PLU is used to create small combinatorial and/or sequential logic networks including simple state machines. The PLU is comprised of an array of 26 inter-connectable, 5-input Look-up Table (LUT) elements, and 4 flip-flops. Eight primary outputs can be selected using a multiplexer from among all of the LUT outputs and the 4 flip-flops. An external clock to drive the 4 flip-flops must be applied to the PLU_CLKIN pin if a sequential network is implemented. Programmable logic can be used to drive on-chip inputs/triggers through external pin-to-pin connections. A tool suite is provided to facilitate programming of the PLU to implement the logic network described in a Verilog RTL design.   Advantages Some advantages of the PLU are: Replace the combinational logic of the 7400 series. State machine design using Flip-flop. Address decoder. Pattern match. Low-power application. PLU works in deep-sleep and power-down mode. Programmable so PLU can be reprogrammed and reused. Seamless connection using SWM and PLU. Pin description There are up to six primary inputs into the PLU module, one clock input, and eight primary outputs. All the inputs are connected directly to the package pins via chip-level I/O multiplexing.  All these pins can be enabled by configuring the relevant SWM register (PINASSIGN_FIXED0). A particular logic network may not require all of the available inputs or outputs. The user can specify which inputs and outputs to use, and which package pins those inputs and outputs will connect to as part of the overall top-level IO configuration. Registers Programming the PLU to implement a particular logic network involves writing to the various Truth Table registers to specify the logic functions to be performed by each of the LUT elements, programming the Input multiplexer registers to select the five inputs presented to each LUT, and programming the Output multiplexer register to select the eight primary outputs from the PLU module. Programming of all of these registers is performed only during initialization. Table 1. PLU registers PLU Shield board with LPCXpresso804 The OM40001 package includes a shield board for use with the LPCXpresso804 board when prototyping programmable logic unit (PLU) designs. The PLU shield provides the following features to assist with this type of development: 5 slide switches to enable 5 possible PLU inputs to be connected to VDD (marked as VCC on the Shield) or GND through a resistor (to set those inputs to a logic 1 or zero). 8 LEDs with jumpers to connect/disconnect possible PLU outputs for visual status indication. Push button option for momentary / edge signal inputs. Low-frequency oscillator with 1024Hz and 8Hz outputs. The PLU shield also includes a test circuit that can be used to implement a simple continuity tester. Several signals from the LPC804 used on the PLU Shield are shared with other functions on the main LPCXpresso804 board. Please review jumper settings on the LPCXpresso804 board carefully before installing the PLU Shield. https://www.nxp.com/docs/en/user-guide/UM11083.pdf  Figure 3. LPCXpresso804 + PLU Shield = PLU demo board   PLU input options On/off switches S1 through S5 connect possible PLU inputs to VDD or GND via a resistor, enabling those inputs to be driven to a known, fixed state. PIO0_8 is connected to a push button (S6) and a 100kohm pull up to VDD; PIO0_8 will be grounded when the button is pressed. Table below shows these connections. Table 2. PLU input on/off switches. A digital oscillator circuit is also included on the Shield, with 1.024kHz and 8Hz outputs available. LPC804 signal PIO0_1 can be connected to these oscillator signals in order to provide a low-speed clock to the flip-flops in the PLU block. The center pin (2) of JP12 connects to PIO0_1, so a jumper can be placed onto JP12 to connect this signal to the required clock (see markings on the Shield silk screen.) An external clock can be provided to the PLU by connecting it to the center pin of JP12. PLU output options LEDs are used to monitor the PLU outputs. Due to the limited number of pins on the chip/board, some of the inputs and outputs are shared. Table 3. PLU shield LEDs. PLU examples You have two options to find a PLU example: Using the SDK for the LPCXpresso804. You can download the SDK for the LPCXpresso804 from Welcome | MCUXpresso SDK Builder The PLU project is a simple demonstration program of the SDK PLU driver. In this example, a number of switches are used act as PLU inputs and LEDs are used to monitor the PLU outputs to demonstrate the configuration and use of the Programmable Logic Unit (PLU). Using the LPC804 Example Code Bundle. Code Bundle, containing source code for drivers, example code and project files. You can download it from LPCXpresso804 board for LPC804 Microcontroller (MCU)|NXP  It is recommended to use the PLU configuration tool. Please check the following links for more details. PLU Tool Direct, LUT-based design: https://www.nxp.com/video/part-2-plu-tool-direct-lut-based-design:Part2-PLU-config-tool-verilog PLU Tool Schematic design: https://www.nxp.com/video/part-3-plu-tool-schematic-design:Part3-PLU-config-tool-schematic PLU Tool Importing Verilog files: https://www.nxp.com/video/part-4-plu-tool-importing-verilog-files:Part4-PLU-config-tool-directlut
查看全文
        In recently, NXP released a new sub-series: LPC80x which contains two kinds: LPC802 and LPC804 now, they have a variety of package types for choose and the LPC804 seems like the advanced version to LPC802. For details, please refer to these two articles: 《小巧‘零’珑的MCU:LPC80X面面观》 《LPC800系列选型指南》        Below are block diagrams of LPC802 and LPC804. We can find the difference easily after comparing them. Fig1 LPC802 system block diagram Fig2 LPC804 system block diagram        According to the above two figures, we can find that LPC804 has the capacitive touch interface, programmable logic unit (PLU), 10-bit DAC output, and an I2C interface. But these peripherals are not supported in the LPC802. In further, LPC804 has two times as much memory as LPC802 does.Especially, the capacitive touch interface provides hardware support for LPC804 to design the complex HMI implemented.        In the coming section, I'd like to illustrate the problem capacitive touch demo and share some experience to overcome it. Capacitive Touch Demo Testing 1. Evaluation board (OM40001) Fig3 LPCXpresso804 Develpment Kit        2. Demo code        CapTouch_5ch demo is from Code Bundle (supports Keil, IAR, and MCUXpresso), after reset, all the 5 LEDs would be On and Off one by one and flash together. Please do not touch the pads during this period. After all the LEDs are silent, touch any pad and the responding LED will be on until your finger moves away. Meanwhile, run the Freemaster project to monitor the sensing value in runtime. Fig4 Capacitive Touch Shield Fig5 FreeMASTER monitor the sensing value          3. Testing summary         In general, the testing result is not very good, for instance, when touching S4 and S3, LED D1~D5 may be lighted arbitrarily, even the S1 and S2 which have the best performance,  the responding LED usually be on when touching them, sometimes other LEDs would response the touching event.         Combining with the observation of FreeMaster, it can get the conclusion that the discrimination of these touchpads is not enough to distinguish each other.          4. Workaroud         According to the feedback from the AE co-worker, the discrimination performance of the touchpad is mainly determined by the PCB design and the power supply source. Obviously, the touchpad is impossible to be modified, so we should consider eliminating the power supply's noise to improve the performance.          I tried these three power source for supply. Using the USB port of the notebook, meanwhile, the notebook is supplied by 220 V, 50 Hz Using the USB port of the notebook Using mobile power       After several rounds of testing, it illustrates that demo code can work well when using mobile power to supply, as the mobile power is clean enough and the noise is the smallest.       Note: Slowing the FCLK can extend the scan period for a channel (more energy is released through YL for each recharge cycle), then increase the discriminability performance.  mobile power supply
查看全文
Do you want to know more about one of our hottest products in the LPC800 series portfolio? Take a look at this technical presentation featuring the LPC84x MCU family. Based on the Arm Cortex-M0+ core, the LPC84x Family of MCUs is a low-cost, 32-bit MCU operating at frequencies of up to 30 MHz. The LPC84x MCU family supports of up to 64 KB of flash memory and 16 KB of SRAM. In addition, to make things easier, the LPC800 series McUs are supported by our free example code bundles and now, they're also supported by the MCUXpresso Software Develpment Kit (SDK).  Fig 1. LPC84x MCU Family Block Diagram
查看全文
Live at Computex 2018 this week is: The High Performance Gaming Mouse Controlling Hundreds of Full Color LEDs Powered by LPC51U68 A 100MHz Arm® Cortex®-M0+ delivering real-time response for game player 96K SRAM for LED pattern allows for a smooth transition  Built-in USB drivers in ROM and supports 1K report rate 8 Flexcomm serial channels to drive up to 800 LEDs with full color control at the same time
查看全文
The LPC800 series is a 32-bit, Arm® Cortex®-M0+-based MCU portfolio offering a range of low-power, space efficient, low-pin-count options for basic microcontroller applications. Unique among low-end devices, the LPC800 series MCUs include differentiated product features, such as an NFC communication interface, programmable logical unit (PLU), mutual capacitive touch, switch matrix for flexible configuration, patent-approved SCTimer/PWM, and more – including a comprehensive enablement offering to help you get to market faster. LPC80x 15 MHz|Arm Cortex-M0+|32-bit Microcontrollers (MCUs)|NXP  Webinar series are now available for on-demand viewing, you can get access to the webinars by clicking on the following links:   (5/31) Part I: Thinking about migrating from 8-bit? Wait no longer - LPC80x MCUs are your 32-bit answer! Learn more about the LPC80x MCU family, discover the features, target applications, tools, software and how to get started right away with your 32-bit design.   (6/07) Part II: Creative ways to leverage the LPC804 MCU’s integrated programmable logic feature Continuing its history of innovation in MCUs, NXP introduces a programmable logic unit (PLU) to the LPC family for the first time with the LPC804 MCU. We'll show you how easy it is set up the PLU as we will explore several real-world examples of the challenges many face, but can be overcome with this unique feature.   (6/14) Part III: Get started fast with this comprehensive enablement offering for LPC800 MCUs In May 2018, NXP expanded the MCUXpresso suite of software and tools to include full support for the LPC800 MCU family. Learn about the MCUXpresso IDE, configuration tools and SDK support that is now available for the most cost-effective and compelling family of Arm-based 8-bit replacement microcontrollers available.   (6/21) Part IV: Got NFC? LPC8N04 does - Learn how to leverage this unique feature in your next design? Learn more about the LPC8N04 MCU, its features, and how to get started with NFC quickly by leveraging the available development   Presentations for the webinars are also available now!
查看全文
Flashing and Installing the new firmware and drivers for LPC11U35 debug probes   We recently released a new set of debug firmware and Windows 7 drivers for our boards that feature the LPC11U3x MCU as a debug probe (so all the "MAX" boards). The new firmware can be found under the Software & Tools tab of the board page or it can download directly from this link:  Firmware and drivers for LPC11U35 debug probes The intention is for this firmware to be used instead of the mbed-based firmware and driver that has been used up until now, if you are not going to use MBED (you can continue to use the MBED version if you so wish however). Some reasons to consider the new firmware & driver: - The CMSIS-DAP implementation is newer, so a little more robust and faster. - The VCOM / serial port driver supports autobaud, with speeds up to 115200. - The VCOM driver has a cleaner installation (mbed serial port driver needs board to be plugged in to install, which is a little unusual). - The firmware auto-detects if a target serial port connection is present and enumerates a driver if they are. - The new firmware gives a unique ID per board, allowing multiple board connections at once. To install the windows drivers follow these steps: 1) Unzip the Firmware and drivers and double click on the LPC11Uxx_Debug_Probe_VCOM_v1.0.0 executable:     2) The installation wizard will show up, click on Next: 3) Choose the install location, the driver is installed by default in C:\Users\[USER]\AppData\Local\NXP Semiconductors\LPC11Uxx_VCOM\ but you can override this: 4) You will be asked to install the drivers, click on Install (These drivers were developed by www.ashling.com and are the intellectual property of NXP): 5) Finally click on Finish: The next step is to update the debug probe (LPC11U3x) firmware: 1) Unplug the usb connector. 2) Hold down the reset button and plug in the usb connector. 3) The board will appear on your system as a disk called CRP DISABLD. 4) Delete the file called firmware.bin on this disk. 5) Drag and drop the new binary image. 6) Connect and re-connect usb, you will have an additional VCOM port shown in Windows Device Manager: Hope it helps! 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.    
查看全文
        The all LPC MCU contain In-System Programming which is able to programming or reprogramming the on-chip memory by using the bootloader software (Flash Magic) with the UART, CAN, USB, SPI, or other peripherals etc. The UART is available in all LPC MCU, whereas other peripheral interfaces may be only supported in particular sort of MCU. The article introduces the CAN ISP implementation for the NXP’s LPC microcontroller family.     Overview        Taking the LPC11Cxx as an example, The C_CAN bootloader is activated by the ROM reset handler automatically if meets CAN ISP option. The C_CAN bootloader initializes the on-chip oscillator and the CAN controller for a CAN bit rate of 100 kbit/s and sets its own CANopen Node ID to a fixed value. The bootloader then waits for CANopen SDO commands and responds to them. These commands allow to read and write anything in a so-called Object Dictionary (OD). The OD contains entries that are addressed via a 16-bit index and 8-bit subindex. The command interface is part of this OD. In a word, these C_CAN ISP command handler allows to perform all functions that are otherwise available via the UART ISP commands, and the Table 1 summarizes the commanders. Table 1  CAN ISP SDO communication         The CAN ISP node listens for CAN 2.0A (11-bit) messages with the identifier of 0x600 plus the Node ID 0x7D equaling to 0x67D. The node sends SDO responses with the identifier 0x580 plus Node ID equaling to 0x5FD. The SDO communication protocols“expedited”and “segmented” are supported. This means that communication is always confirmed: Each request CAN message will be followed by a response message from the ISP node. However, the SDO block transfer mode is not supported. Fig1 CAN ISP object directory    CAN ISP Implementation           Hrdware preparation          LPCXpresso board LPC11C24 : OM13093 Fig 2 OM13093          PCAN-USB     Fig 3 PCAN-USB          Hardware assembling         Software preparation          Starting the Flash Magic, then follow the below figures to programing and executing the application demo. Fig 5           Result        Hex file: periph_blinky.hex (Froming the LPCopen library) Fig 6 Led is blinking
查看全文
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 document explains how to start with LPCXpresso845-MAX Evaluation Board building, running and debugging example codes. Introduction   Based on the ARM Cortex-M0+ core, LPC84x is a low-cost, 32-bit MCU family operating at frequencies of up to 30 MHz. The LPC84x MCU family supports up to 64 KB of flash memory and 16 KB of SRAM. There is no LPCOpen nor SDK for LPC84x, however there is an example code bundles (register level) available for this family. The example code bundles offer a fastest, and simplest way for user to learn how to program each peripheral before progressing to more advance features of the peripheral. New users of LPC84x can step through the Example Code like a tutorial. Each project contains concise and accurate explanations in Readme files and comments in source files help the user to start/debug quickly. LPC845 Example Code Bundle is available for KEIL, MCUXpresso and IAR IDEs and you can download it from next link:   http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc800-series-cortex-m0-plus-mcus/low-cost-microcontrollers-mcus-based-on-arm-cortex-m0-plus-cores:LPC84X?tab=Design_Tools_Tab Build, run and debug an example   This section describes the steps required to build, run, and debug an example application. 1. Download the LPC845 Example Code Bundle MCUXpresso from the next link:  http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc800-series-cortex-m0-plus-mcus/low-cost-microcontrollers-mcus-based-on-arm-cortex-m0-plus-cores:LPC84X?tab=Design_Tools_Tab 2. Open MCUXpresso IDE. 3. Select "Import project(s) …" from the Quickstart Panel. 4. Click the "Browse" button and point to the LPC845-Example-Code-Bundle-MCUXpresso.zip, which should be downloaded previously, and then click “Next” button. 5. By default all the projects are selected, however you can select only the desired example project. In order to build the example project, it is necessary to add in the workspace the following projects: common peripherals_lib utilities_lib For this document, we are using the Multi_Timer_Blinky example project. 6. Build the project using the hammer icon on Quickstar Panel.  7. Connect the development platform to your PC via USB cable. If connecting for the first time, allow some seconds for the devices to enumerate.   8. This example runs from Flash. To run this code you have two options: a) Download and Debug.    b) Load to flash using the “run” IDE icon and press the reset button on the board. Note: It may be necessary to power-cycle the board in order to regain control of the reset button after programming. At this moment, you can be able to run or debug the example project. I hope this helps!!!
查看全文
Demo demonstrate how to use EMC to connect with external SDRAM.
查看全文
LPC China team creats a serial of LPC82x training slides with hands-on examples for GC customers, disti and fans. And all the material are written in Chinese. This is just the SCT chapter of the whole serials. Enjoy it. #sct‌ #lpc824‌ #lpc82x‌
查看全文
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‌
查看全文