LPC Microcontrollers Knowledge Base

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

LPC Microcontrollers Knowledge Base

Discussions

Sort by:
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.
View full article
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‌
View full article
Introducing MCUXpresso SDK v.2 for LPC54xxx Series What's New in MCUXpresso SDK v.2 for LPC54xxx? The Software Development Kit (SDK) 2.0.0 is a collection of software enablement for microcontrollers that includes peripheral drivers, multicore support, and integrated RTOS support for FreeRTOS OS and μC/OS. In addition to the base enablement, the SDK is augmented with demo applications and driver example projects, and API documentation to help the customers quickly leverage the support of the SDK. Development Tools The MCUXpresso SDK v.2 for LPC54xxx 2.0.0 was compiled and tested with these development tools: - LPCXpresso 8.2.0 - IAR Embedded Workbench for ARM® platform version 7.60.2 - MDK-ARM Microcontroller Development Kit (Keil)® 5.20 Supported Development Systems Development boards MCU devices LPCXpresso54114 LPC54114J256BD64, LPC54114J256UK49, LPC54113J128BD64, LPC54113J256BD64, LPC54113J256UK49 LPCXpresso54608 LPC54605J256ET180, LPC54605J512ET180, LPC54606J256ET180, LPC54606J512BD208, LPC54607J256ET180, LPC54607J512ET180, LPC54607J256BD208, LPC54608J512ET180, LPC54608J512BD208   SDK Board Support Folders SDK board support provides example applications for development and evaluation boards. Board support packages are found inside of the top level boards folder, and each supported board has its own folder (a SDK package can support multiple boards). Within each <board_name> folder there are various sub-folders to classify the type of examples they contain.   demo_apps: Full-featured applications intended to highlight key functionality and use cases of the target MCU. These applications typically use multiple MCU peripherals and may leverage stacks and middleware. driver_examples: Simple applications intended to concisely illustrate how to use the SDK’s peripheral drivers for a single use case. These applications typically only use a single peripheral, but there are cases where multiple are used (for example, ADC conversion using DMA). rtos_examples: Basic FreeRTOS examples showcasing the use of various RTOS objects (semaphores, queues, and so on) and interfacing with the SDK’s RTOS drivers usb_examples: Applications that use the USB host/device/OTG stack. multicore_examples: Applications for both cores showing the usage of multicore software components and the interaction between cores. Example Application Structure This section describes how the various types of example applications interact with the other components in the SDK. To get a comprehensive understanding of all SDK components and folder structure, see the SDK v.2.0 API Reference Manual document (SDK20APIRM). Each <board_name> folder in the boards directory contains a comprehensive set of examples that are relevant to that specific piece of hardware. We’ll discuss the hello_world example (part of the demo_apps folder), but the same general rules apply to any type of example in the <board_name> folder. In the hello_world application folder you see this: All files in the application folder are specific to that example, so it’s very easy to copy-paste an existing example to start developing a custom application based on a project provided in the SDK. Related links: For information on how to import and debug the MCUXpresso SDK example projects using LPCXpresso or generate your MCUXpresso SDK package take a look to this document: How to start with SDK v.2.0 for LPC5411x using LPCXpresso IDE Generating a downloadable MCUXpresso SDK v.2 package https://community.nxp.com/docs/DOC-333369  MCUXpresso Config Tools is now available!  
View full article
  Background LPC55(S)XX and MCX series products support updating firmware (ELF, HEX, BIN or SREC/S19) in ISP mode, including USB, UART, SPI, and I2C  connection interfaces.  There was no official host software tool supporting SPI-ISP and I2C-ISP before, so it was difficult for customers to update firmware files through I2C and SPI in ISP mode. Now NXP has launched MCUXpresso Secure Provisioning Tool(SEC or SPT), a graphical interface tool that makes it easy to connect through the four ISP interfaces. Based on the SEC, this article takes LPCXpresso55S69 as an example to introduce the methods of updating firmware in four modes: USB-ISP, UART-ISP, SPI-ISP and I2C-ISP.   Preparation (1)Software MCUXpresso Secure Provisioning Tool is a graphical user interface tool, which is mainly used for security configuration. When  MCU is in the ISP mode, you can use this tool to connect and communicate, it support all interfaces of  ISP. LPC55(s)xx series include four ISP download interfaces: USB, UART, SPI, and I2C. This article is based on this to introduce. (2)Hardware LPCXpresso55S69-evk development board (chip version is 1B)   Steps Make chip into ISP mode before  using SEC tool connect. When power-on, BOOT ROM determines whether enter the ISP mode, based on the CMPA configuration in bit DEFAULT_ISP_MODE and ISP pin status. As shown in  following tables:     Keep the default value of EFAULT_ISP_MODE to “000”, and enter the ISP mode by pulling down the ISP pin PIO0_5. The first valid probe message on USART, I2C, SPI or USB locks in that interface. On LPCXpresso55S69 development board, connect the ISP interface cable (USB\UART\SPI\I2C), press and hold the ISP button, power on,  it will  enter ISP mode.   3.1 USB HID ISP mode (1)In LPC55(s)xx, HS-USB is default USB-ISP port, LPCxpresso55s69-evk uses P9 port, use USB cable to connect P9 and PC. (2)Press and hold  ISP button, reset board, entered ISP-USB mode. (3)Configure MCUXpresso Secure Provisioning Tool: select USB connection mode, test connection. First, click "File->New Workspace", open the option to create a new workspace, and select the processor model you are using.     Then, click "Target->Connection" to open the connection configuration.   In configuration, select USB interface, click “Test Connection” button, if the result shows " ok", connected successfully.   (4)Select the source file in "Source executable image". This tool can build plaint image, signed image, and encrypted image. You can configure it according to your own requirements. For example, use a plain image file "lpcxpresso55s69_gpio_led_output.hex", this file is a binary file generated from MCUXpresso IDE under the SDK example. Click the "Build image" button, ensure that the compilation was successful.     (5)Download the image file Choose “Write Image” view, in “Image path” select the image generated by the previous step, then click  “Write Image” button.   If download  successfully, the following picture will be displayed:     3.2 UART ISP mode (1)LPC55(s)xx  use UART0 as UART-ISP interface, you can use USB cable to connect P6 of LPCxpresso55s69-evk and PC, or use USB-UART convertor to connect UART0 TX/RX and PC. (2)Enter ISP mode, refer to 3.1. (3)Configure MCUXpresso Secure Provisioning Tool, refer to 3.1, select UART connection mode, and perform connection test.   Step 4 and step 5 are the same as 3.1.   3.3 SPI ISP mode (1) LPC55(s) 2x/6x currently includes two versions, 0A and 1B, which can be checked from the chip mask. The 0A version supports SPI3 and HS_SPI ISP interface, and the 1B version only supports HS_SPI ISP interface. This article uses version 1B for the experiment. Both SPI and I2C use LIBUSB interface, LPC-LINK2 and MCU-LINK pro support this function interface, so as long as there is LPC-LINK2 or MCU-LINK pro, SPI-ISP and SEC tool connection can be realized. Special reminder: LPC-link2 and MCU-LINK pro must be updated to CMSIS-DAP debugging interface, J-link does not support this function. In the LPCxpresso55s69-evk development board, SPI3 is connected to LPC-LINK2 by default, and HS_SPI is not connected, so  an external connection is required, connect SCK, MOSI, MISO, and SSEL1 of HS_SPI to the corresponding positions of LPC-link2. For details, please refer to the lpc55xx manual and the development board schematic. It can also be connected according to the figure below. The connection of the development board is shown in the below picture   (2) Connect the USB cable to the P6 port. (3) Enter ISP mode, refer to 3.1. (4) Configure MCUXpresso Secure Provisioning Tool, refer to 3.1, select the SPI connection mode, and perform a connection test.   Step 5 and step 6 are the same as 3.1.   3.4 I2C ISP mode The I2C-ISP mode is the same as SPI, with the help of the LIBUSB interface, that is, the LPC-link2 on the development board. Special reminder: LPC-link2 and MCU-LINK pro must be updated to CMSIS-DAP debugging interface, J-link does not support this function. (1)  Connect the USB cable to the P6 port. (2)  LPC55(s)6x/2x uses I2C1, and LPCxpresso55s69-evk development board has already connected I2C1 and LPC-LINK2, no need additional connection. (3)  Enter ISP mode, refer to 3.1. (4) Configure the MCUXpresso Secure Provisioning Tool, refer to 3.1, select the I2C connection mode, and perform a connection test.   Step 5 and step 6 are the same as 3.1.   Summary (1) All ISP interfaces (USB/UART/SPI/I2C) are supported by MCUXpresso Secure Provisioning Tool. (2) LPC-link2/MCU-LINK pro must be configured as CMSIS-DAP debug probe. (3) Check the chip version and make sure use the correct SPI port. (4) Make sure that the usb  cable interface is connected correctly and must enter the ISP mode before testing the connection.      
View full article
1. Background When an embedded device is being upgraded, due to external factors such as power outage and forced interruption, the new firmware can‘t be written completely into flash, which causes problems when the system is started. Or if the image file is damaged during device is currently running, the system will break down and the device cannot run. To solve these problems, you can use the dual image, which ensures that at least one image file can be started and works properly at any time. If anything goes wrong, the bootloader detects and uses the alternate image file. 2. Principle LPC5536 ROM supports the dual image boot for internal flash, that means, in the flash region, two boot images can be placed there; ROM decides to boot which image based on the image version, boot the one with the newer image version first, if fail, boot the older one. During power-on and startup, the ROM first detects the location and size of the relocated image file in the CMPA, and then detects the version number of the two images. Therefore, when the dual image is used,  mainly need configure the relocation address and version number of the image files. The internal flash boot flow for dual image is as follows:   2.1 Relocating Image File The LPC5536 internal flash supports remapping. When set the remap offset, Internal FLASH memory AHB access will change the access address adding the offset as the below figure shows. For example, when the offset is set to 128K(0x20000), the access to 0x0 will be remapped to 0x20000. Via this IP feature, ROM can implement a dual image boot with two images. The offset and the remap size of the image is set in CMPA region by the user. This is an illustration of two image files stored in internal FLASH. The offset and remap size of the second image is set by the user in the CMPA area to let ROM know the location of the second image.   2.2 Configuring Image Version The image version is the image header offset 0x24; bit 10 shows whether the image contains the image version for not; if bit10 is 0, that means the image has no image version; ROM will take the image version as 0.   3、Implementation 3.1 Configuring CMPA 1) Configure Data Values in the CMPA Use blhost to write the modified bin file to CMPA to configure the image1 offset and remap size. The procedure is as follows: First, open an all “0” cmpa.bin and change the data at 0x3E23C to 0x20000, as shown in the figure below:   Then, modify the remap size. The data at address 0x3E238 is changed to 0x1d800, as shown in the following figure:   Modify and save, rename as cmpa_new.bin, save as \blhost_2.6.7\blhost_2.6.7\bin\win. 2) Download cmpa_new.bin Blhost 2.6.7 is a command-line tool, that use it to program cmpa_new.bin. Check whether the communication between blhost and development board is successfully. Firstly, check the port number for connecting between development board and computer from  device manager.   Secondly, short 3 and 4 of jumper J43 on lpc55s36-evk to enable ISP boot. Thirdly, press the reset key to reset board, input connection test command “blhost-p com12 -- get-property 1” Check whether communication is normal. If connection is successful, the message will be displayed as below:   Program modified bin file into CMPA. Write CMPA by using command “blhost-pcom12 -- write-memory 0x3e200 cmpa_new.bin”as shown below:   Read back CMPA data after writing. To confirm the accuracy of the data, run command “blhost-pcom12 -- read-memory 0x3e200 512” to view the configured CMPA data, as shown in the following figure:   3.2 Setting Dual Image Version To observe experimental effect, Image0 function is the RED light on LPC5536-evk development blinking, Image1 function is BLUDE light blinking. In Image0 project, set version number to 1, in Image1 set version number to 2: Open the project of red light blinking and change the header file to 0x10400 at offset 0x24.   Open the project of blue light blinking and change the header file to 0x20400 at offset 0x24.   3.3 Remap Flash For users, LPC5536JBD100 has a total of 246K internal flash available, so Image0 is assigned to the address range 0x00000-0x1FFFF and Image1 is assigned to the address range 0x20000-0x3D7ff. If using MCUXpresso ID, the Settings are as follows: Right-click Selected Project -> choose Properties ->MCU settings, set the Location (start address) and Size, click  Apply button when finished. The red light blinking project are modified as follows:    The blue light blinking project modified as follows:   Re-compile the project.  3.4 Functional Testing Test application is two lighting projects, namely red light blinking and blue light blinking. The red light blinking is image0, version 1, and the blue light blinking is image1, version 2. Therefore, if test result is blue light blinking, dual image function works successfully.. Download Images: Using GUI Flash Tool in MCUXpresso IDE, download two image files to the development board:   Open, and the following view pops up. Select download File in "File to program", then click run button, image will be downloaded to flash.   When the download is complete, click OK.   Download another image in the same way. Note that "mass erase" cannot be checked when programing the second image. If you use other tools to program, also should disable the same function as "mass erase", avoid erasing the first image file. Test result: After downloading the program and reset, the blue light blinking. Further test: Change the version number of red light blinking project to 3, that is, modify 0x10400 to 0x30400. Then downloading the image file again. The red light blinking. 4、Summary Dual image function increases the security for boot and firmware update of embedded devices. It is necessary to pay attention to the way of setting image offset, remapping size and configuring image version in the CMPA area when using it, and also pay attention to the flash configuration in the two projects.   Attachment is test application project.
View full article
The ADC of LPC55xx supports scan mode, in scan mode, once ADC triggering (either hardware or software) can convert multiple analog channels. The document gives an example that the CTImer2 module triggers ADC and ADC converts two analog channels for each triggering. The doc introduces the CTimer configuration, ADC triggering control register configuration, and ADC Command buffer chain and ADC result reading , in this way, the CTimer can trigger ADC, the ADC can convert multiple channels. The example and the doc are attached. The Example is developed based on SDK example lpcxpresso55s69_lpcadc_interrupt example, the tools is MCUXprsso IDE ver11.7, the SDK package is SDK_2.x_LPCXpresso55S69 ver2.11.1  
View full article
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
View full article
After LPC54XXX enter ISP mode, there are two methods to upgrade the application through UART/I2C/SPI/USB. One method is to change the ISP pin state when power on, and the other method is to reinvoke ISP Boot ROM in source code during code running. The first method does not require user to write any code, and the operation is simple, but the disadvantage is that it is not flexible and is not suitable for on-site operation; The second method is more flexible and is widely used in Secondary Bootloader applications developed by yourself, but it requires users to write their own code. In actual development, because the USB port of personal computer is easy to use, the method of using the USB port for application upgrade is becoming more and more popular. Unfortunately, we currently do not have instructions for upgrading the application by the USB port in ISP mode. So we write this article to share the method here.   There are two methods to enter ISP mode: Method 1: Enter ISP mode to upgrade the application during power on On the hardware side, configure the ISP0~2 pins before power-on or reset, and the MCU enters ISP mode to upgrade the application. The pin configuration method is as follows: Figure 1.   Method 2: Activate Reinvoke ISP in source code to upgrade the application In ISP mode, the application is upgraded through UART/I2C/SPI/USB. This article focuses on the USB method. Here for USB, Both USB0 (Full Speed) and USB1 (High Speed) of LPC54XXX can be used for application upgrade. There are two USB upgrade modes: DFU (Device Firmware Updata) and MSC (Mass Storage Device Class), as follows: Figure 2.   Select the application upgrade mode by modifying byte 0 and byte 1 of the ISP parameter array. The key code is as follows Figure 3.   There are 3 key point we need to pay attention in Figure 3: -When isp_mode[0] is configured as 0xAA, it is DFU mode, otherwise it is MSC mode (for example, isp_mode[0] is configured as 0xFF). -When isp_mode[1] is configured as 8, USB FS is used, and when it is configured as 9, USB HS is used. -Enter the ISP mode through the Chip_IAP_ReinvokeISP function. 2.1 Use DFU for application upgrade Tool preperation: To work with DFU, dfu-util tool is needed to use DFU to upgrade the application, you can download the DFU tool on the DFU official website. The link is as follows: http://dfu-util.sourceforge.net/ NXP also includes the dfu-util tool in LPCScrypt. If you have downloaded LPCScrypt, you can use it directly in the bin directory.   DFU update application Steps: Take LPC54628 as an example, ISP is configured as DUF mode, and USB1 is used to upgrade the application. Modify the relevant code in Figure 3, as follows: isp_mode[0] = 0xAA; isp_mode[1] = SL_USBHS; Build and download the application to the MCU, power on again, and connect USB1 to the computer. Here Enter the dfu-util tool directory and copy the .bin file to the current directory. Use the command: ./dfu-util -l   Find the DFU devices. Use the command: ./dfu-util -D .\lpcxpresso54628_gpio_led_output.bin -a 0 Download the lpcxpresso54628_gpio_led_output.bin file to the device with alt number 0. Alt0 is "FLASH", alt1 is "RAM", and the specific operations are as follows:   Figure 4.   After downloading the application successfully, reset the MCU and observe the blinking phenomenon of the LED on the development board.   2.2 Use MSC for application upgrade Take LPC54628 as an example, ISP is configured as MSC mode, and USB1 is used to upgrade the application. Modify the relevant code in Figure 3, as follows: isp_mode[0] = 0xFF; isp_mode[1] = SL_USBHS; Build and download the application to the MCU, power on again, and connect USB1 to the computer. You will found another disk in my computer, as follows: Figure 5.   Then do the following to update firmware: -Remove the original firmware.bin in the CRP DISABLD disk. -Rename the application (for example, lpcxpresso54628_gpio_led_output.bin) to firmware.bin. -Copy the application firmware.bin to the CRP DISABLD disk. -Reset the MCU, if the LED is observed blinking, it proves that the application has been successfully upgraded. Note: The application must be renamed, and the rename cannot be performed in the CRP DISABLD disk.   Demo project:lpcxpresso54628_flashiap.zip Application upgrade file:lpcxpresso54628_gpio_led_output.bin (generated by SDK demo code)
View full article
At the time of the latest update to this article, the latest silicon revision of the LPC55S6x is revision 1B. Since Nov,2019, all the LPCXpresso55S69 EVK boards marked as Revision A2 or A3 are equipped with revision 1B silicon. Initial production boards that have 0A silicon installed are marked Revision A1.                                     NXP introduced its new debug session request functionality on silicon revision 1B. For some IDE versions, the method of initiating a debug session is designed for current 1B silicon revisions and will result in an endless loop when used on older revision 0A parts due to the older revision not implementing some aspects of the handshake protocol. The protocol for this debug connection method, including handling of both 0A and later silicon revisions correctly, is included in the latest LPC55S6x/S2x/2x User Manual, section Debug session protocol.   IDE Considerations MCUXpresso IDE MCUXpresso IDE v11.0.1, incorrectly only supports silicon revision 1B debug session requests and cannot silicon to revision 0A parts in some situations. When connecting LPCXpresso55S69 Revision A1 board, you may have connection error like this: NXP released an MCUXpresso IDE v11.0.1 LPC55xx Debug Hotfix1 for this issue. Please follow the steps to fix the issue below if you have to use IDE v11.0.1 with silicon revision 0A; however it is recommended to update to the latest version of the IDE instead of taking this approach: https://community.nxp.com/community/mcuxpresso/mcuxpresso-ide/blog/2019/10/30/mcuxpresso-ide-v1101-lpc55xx-debug-hotfix IAR According to our test: IAR Embedded Workbench for ARM v8.42 and later can support both silicon revision 1B and 0A production without issue, which can be downloaded from https://www.iar.com/iar-embedded-workbench/tools-for-arm/arm-cortex-m-edition/ Note: The IAR 8.50.5 changed the CMSIS-DAP debug support for trustzone feature. There is known debug issue with the combination of IAR 8.50.5+SDK2.8.0. Thus our recommendation is:        Use IAR 8.50.5 with SDK2.8.0       Use IAR 8.40.2 with SDK 2.7.1   Keil MDK Both Keil MDK v5.28 and v5.29+ latest LPC55S69 pack v12.01 can support silicon revision 1B without problem but cannot support silicon revision 0A. LPC55S69 Revision 0A vs. 1B differences summary Silicon Revision 0A production 1B production Board Revision A1 A2 Deliver Date Before Nov,2019 After Nov,2019 Debug Access handshake Supported but not required. Handshake signaling partially supported Required Secure Boot Revision SB2.0 SB2.1 Maximum CPU Frequency 100MHz 150MHz IDE revision required 1.      MCUXpresso IDE v11.0.0 and older 2.      MCUXpresso IDE v11.0.1 + hotfix1 3.      MCUXpresso IDE 11.1 and later MCUXpresso IDE v11.0.0 and newer SDK version SDK2.5 and newer are supported; SDK2.6.3 and newer are recommended SDK2.6.3 and newer     LPC55S69 Defect Fix: 0A vs. 1B 0A Production 1B Production Defect: For PRINCE encrypted region, partial erase cannot be performed Fixed Defect: For PUF based key provisioning, a reset must be performed Fixed Defect: Unprotected sub regions in PRINCE defined regions cannot be used. Fixed Defect: Last page of image is erased when simultaneously programming the signed image and CFPA region Fixed Defect: PHY does not auto-power down in suspend mode Fixed For more detail, see Errata sheet LPC55S6x which can be downloaded  from NXP web site.   Pre-production Silicon: Note that NO BOARDS WERE EVER SOLD THROUGH DISTRIBUTION WITH PRE-PRODUCTION SILICON. In case you have board marked with Revision 1, 2 ,A, or A1 board with 1B silicon, contact NXP to ask for production replacement.   Get Silicon Revision: The silicon revision info is marked on the chip and board revision is marked on the board silkscreen. For silicon revision marking information, please consult LPC55S6x Data Sheet section 4. Marking . Below is an example of silicon revision marking information where revision is highlighted in red: The user application can also get the silicon revision through chip revision ID and number: SYSCON->DIEID:     The English and Chinese version documents are attached.  
View full article
        In recent years of MCU technology evolving, booting from the external flash seems to become more and more popular, actually, LPC already has employed this technology for many years.         NXP's recently released the LPC540xx family which continues the trend of high-performance flash-less MCU.         The developers may be a bit confused with the external FLASH which is used for storing the program, as they are used to directly using the internal FLASH for programming and debugging the chip. But, don't worry, let me introduce it in the following sections. LPC54018's three ways of loading program        In general, RAM stores data, however, RAM can also store programs. In previous projects, we occasionally move some key functions in RAM in order to improve the execution speed of these programs. The current implementation is to put all the programs in RAM more thoroughly. Based on this idea, you can directly use the debugger to load the executable image into the on-chip RAM and this method is called RAM TARGET.       After downloading the executable program image file to the external flash, when the bootloader loads the complete image to on-chip RAM to run, the method is called the Plain Load Image method.             Actually, both of these above ideas are routine, chip designers have also created a "super-capability" that allows the chip to directly execute external FLASH programs (Execute In Place, XIP). With this 'superpower', no matter whether the program boot from the external FLASH or the internal FLASH, there is no difference in operating performance.       The RAM TARGET method mentioned above is only suitable for debugging the application. Once the chip is powered off or reset, the downloaded program in the RAM will disappear. Meanwhile, the size of the RAM also give some restrictions for debugging.        In the Plain Load and XIP modes, the executable image file is stored in the external flash. After MCU is powered, the bootloader which is resided in ROM copies the first 512 bytes from the image (vector components and image header) into internal SRAMX at location 0x0000 0000 to validate the vector table and image header to confirm the booting mode. And the program will not be lost after power-off or reset. Fig1 illustrates the boot process of LPC54018. Fig1 LPC54018 boot process flow Experiment show         Board: LPCXpresso54018 board (OM40003) Fig1 LPCXpresso54018 board       Demo code: Hello world (From the SDK), modifying the hello world code in below way, which points out the load program way and date time. PRINTF("hello world. XXXXXXXX \r\n");    PRINTF("hello world, %s, %s.\r\n", __DATE__, __TIME__);‍‍‍‍‍‍‍‍‍‍‍‍ Experiment 1: RAM Target         Demo code: Hello world (From the SDK), modifying the hello world code in below way. PRINTF("hello world. RAM Target \r\n"); PRINTF("hello world, %s, %s.\r\n", __DATE__, __TIME__);‍‍‍‍‍‍‍‍‍‍      Note: Setting the Reset: Core when debugging the demo Fig2 Setting the Reset: Core Running testing: As the Fig3 illustrates, it would print the below message when debugging the demo, however, after reset, it would run the plain load image which is programmed before, as the RAM lost the hello world demo. Fig3 RAM Target runing testing Experiment 2: Plain Load Image        Demo code: Hello world (From the SDK), modifying the hello world code in below way. PRINTF("hello world. PLAIN LOAD IMAGE \r\n"); PRINTF("hello world, %s, %s.\r\n", __DATE__, __TIME__);‍‍‍‍‍‍‍‍‍‍‍‍‍      Download image to external flash:        1. Build the demo to generate a bin file.           This plainload example linked the vector table to 0x00000000, but program to external flash 0x10000000.        2. Program the bin file to external on board flash via SEGGER J-FLASH Lite(V6.22 or higher):             a. Open SEGGER J-FLASH Lite, select device LPC54018.             b. Click the 'Erase Chip' to erase the extrenal flash.(if can not success, press SW4 button and reset the board, and try to erase again)                 Note: if can not success( press SW4 and reset the board, and try to erase again) Fig4 Erase the external flash              c. Select the bin data file, set the '.bin/Erase Start' address to 0x10000000, then click 'Program Device' Fig5 Program the external flash Running testing: Fig6 illustrates the result of  running the plain load image. Fig6 Plain load image runing testing Experiment 3: XIP Image        Demo code: Hello world qspi_xip (From the SDK), modifying the code in below way. PRINTF("hello world. PLAIN LOAD IMAGE \r\n"); PRINTF("hello world, %s, %s.\r\n", __DATE__, __TIME__);‍‍‍‍‍‍‍‍‍‍‍‍‍‍      Download image to external flash:        1. Build the demo to generate a bin file.        2. Program the bin file to external on board flash via SEGGER J-FLASH Lite(V6.22 or higher):            a. Open SEGGER J-FLASH Lite, select device LPC54018.            b. Click the 'Erase Chip' to erase the extrenal flash.(if can not success, press SW4 button and reset the board, and try to erase again)            Note: if can not success( press SW4 and reset the board, and try to erase again) Fig7 Erase the external flash           c. Select the bin data file, set the '.bin/Erase Start' address to 0x10000000, then click 'Program Device' Fig8 Program the external flash      Running testing:      Fig9 illustrates the result of  running the plain load image. Fig9 XIP image runing testing  
View full article
Some customers want to generate CRC checksum during compile project, while the GUN tool chain in MCUXpresso IDE doesn’t include CRC checksum calculation function, so we need  the help of CRC checksum tools. In this article, use SRecord. About detail theoretical knowledge of SRecord, please refer to https://mcuoneclipse.com/2015/04/26/crc-checksum-generation-with-srecord-tools-for-gnu-and-eclipse/ In this thread, mainly describe the steps about how to generate CRC checksum with MCUXpresso IDE post-build, through a hands on.   Environment: LPC54S018 chip MCUXpresso IDE SRecord tool (http://srecord.sourceforge.net/)   Purpose: Generate and place CRC checksum to 0x10000170 of LPC54s018 after compile project. In image header for LPC540xx devices, the offset 0x10 is crc_value, in LPC54s018 , the address is 0x10000170. so we need save CRC checksum value in  this  place.   Steps: Import SDK demo “led_blinky” into MCUXpresso IDE (Just use this demo to demonstrate).   Enable Compute CRC, because there is one bit in Image header for LPC540xx,Just add “ADD_CRC” or “ADD_CRC =1”, build project.     Can check from S19 file: When choose no CRC computation (no defined “ ADD_CRC “ symbol), the data in address 0x0164 bit0 is 1,   When choose compute CRC, the data in address 0x0164 bit0 is 0,        Download SRecord from http://srecord.sourceforge.net/ After download, srec_cat.exe is the main program we used. Place srec_cat.exe utility in a common directory (to reuse it even if you change the project or even the MCUXpresso IDE version). Be sure you add that “common directory” in the PATH environment variable, then be sure the eclipse was restarted to “see” the PATH content.   Create command file crc_add.txt, and place it under" Debug" folder of project. (About detail commands, please refer to SRecord Reference Manual.) # srec_cat command file to add the CRC and produce application file to be flashed # Usage: srec_cat @filename #first: create CRC checksum lpcxpresso54s018m_led_blinky.srec # input file -fill 0xFF 0x10000180 0x10010000 # fill code area with 0xff -crop 0x10000180 0x10010000 # just keep code area for CRC calculation below (CRC will be at 0x1FFFE..0x1FFFF) -CRC16_Big_Endian 0x10000170 -CCITT # calculate big endian CCITT CRC16 at given address. -crop 0x10000170 0x10000172 # keep the CRC itself #second: add application file lpcxpresso54s018m_led_blinky.srec # input file -fill 0xFF 0x10000180 0x10010000 # fill code area with 0xff -crop 0x10000000 0x10000170 0x10000172 0x10010000 #keep all except CRC #finally, produce the output file -Output # produce output lpcxpresso54s018m_led_blinky_crc.srec   Add post-build command to create srecord file with CRC checksum. arm-none-eabi-objcopy -v -O srec "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.srec" & srec_cat.exe @CRC_add.txt   7) Build project, the .srec with CRC checksum file will under Debug folder:         Pay attention: For the format of image header of LPC540xx devices, we need enable compute CRC and put the CRC value in the specific address. while for other chips, maybe do not need enable, and also can place it in your own address.   Reference: https://mcuoneclipse.com/2015/04/26/crc-checksum-generation-with-srecord-tools-for-gnu-and-eclipse/        
View full article
Introduction GUI Guider is a user-friendly graphical user interface development tool from NXP that enables the rapid development of high quality displays with the open-source LVGL graphics library. GUI Guider's drag-and-drop editor makes it easy to utilize the many features of LVGL such as widgets, animations and styles to create a GUI with minimal or no coding at all. In recent years, Smart Home has emerged rapidly and has a strong momentum of development. Smart Homes connect various household appliances and provide services such as lighting control, telephone remote control, burglar alarm and environmental monitoring. Smart Home applications are more and more widely used, but it is difficult for many developers to start. Using NXP GUI Guider can improve the development speed, reduce development difficulty, shorten development cycle. This article mainly introduces the use of GUI Guider to realize some functions of Smart Home, and shares some common methods in the use of GUI Guider, including creating a new project, adding controls, adding events, interface design and layout, and controlling the lighting of hardware lights. Development environment 2.1 Hardware environment Evaluation of LPC54628 -LPCXpresso54628, also applies to LPCxpresso54618, LPCxpresso54608. 2.2 Software Environment This Smart Home demo uses GUI Guider version 1.5.1 to set up the software environment. GUI Guider version 1.5.1 supports LVGL versions 7.10.1 and 8.0.2. This introduction is based on version 8.0.2 LVGL. Download link: https://www.nxp.com/design/software/development-software/gui-guider:GUI-GUIDER Create a new project 3.1 Double-click the GUI Guider icon to start the GUI Guider.   3.2 Click Create a new project (" Create a New Project ") button to start the project creation process.   3.3 select LVGL version v8.3.2 and click Next button.   3.4 Select LPC54628 as the target board template and click Next button.   3.5 Select empty application template EmptyUI and click Next.   3.6 Perform the project Settings, and set the project name, project location, and screen type (select RK043FN66H or RK043FN02H according to your screen type). Click Create to create the project.   3.7 After the project is created, the interface is as follows.   Page Design and Layout This section describes how to adjust the background color, layout, add various controls (Such as images, image buttons, text, and containers , etc), and set properties. 4.1 Create the image folder, and put the image resources needed in the project under the established image folder.   4.2 Adjust the background color of the interface ① Click the Background color icon to open the background color Settings. ② You can set the background Gradient or monochrome by using Gradient. ③ Then select the background color.   4.3 Add images ① Open Widgets control options. ② Click to add the Image control. ③ Then click the image shape button in the Attribute box of the property Settings, and “Select Images” will pop up. In “Select Images”, select the image you want to add, click OK to add the image, and adjust the image size and position.   In the same way, you can add the "small house" image. In the Widgets box, you can view the added image and set the image name. In the Screen box, you can view the current interface and set the interface name.   4.4 Add text ① Open the control options, select and click the Label control. ② In Property Settings Text, set the text content to SMART HOME. ③ Then click the Background background setting area to set the Label control background. ④ Set the color depth of the Label control to 0, without background color. ⑤ Set the Font color, size and style in the font.   4.5 Add a container Containers are essentially basic objects with layout and automatic resizing capabilities. Open the control option, click Container to add the Container control, and drag the control size. Set the background color in the property Settings. ③ Then set the Border and rounded corner of container in "Border".   Name the added Container control cont_TodayInfo. Add other controls to the Container control. You can view other controls (including picture, text, and line controls) added to the cont_TodayInfo container in the Widgets.   4.6 Add an Image button Image button are very similar to simple "button" objects. The only difference is that it displays image in each state defined by the user. ① Open component options, select and click the Imgbtn control. ② Add the Released and Pressed images.   In the same way, add other Imgbtn controls and Label controls.   Switch the interface This section describes how to create sub-interfaces and switch between the main interface and sub-interface. 5.1 Add a second new interface Click “+” to add a new screen, rename the new screen src_Light, add Image, imgbtn controls, and change the background color.   5.2 Add interface switching trigger conditions ① Select the imgbtn_Light button on the first screen. ② Select the Events Settings. ③ Click “+” to add an event, and then set the event. ④  In event Settings, trigger conditions need to be selected, here Clicked trigger conditions are selected. Target Select the second new interface src_Llight that you want to load, and then select the Delete current interface option. When the program is running, when the imgbtn_Light button is clicked, it will switch to the second src_Light interface.   Updating Media   5.3 Add a trigger condition for returning to the interface ① Select the imgbtn_Home control. ② In the event Settings, select Clicked trigger conditions, Target select src_Welcome for the interface to be loaded, and select Delete the current interface option. When the program is running, when the imgbtn_Light button is clicked, it returns to the first main screen of src_Welcome.   5.4 Design the second interface Add controls in the second interface, including Switch control, Slider control, Dropdown control, Image control, Imgbtn control, Label control. Switch control: This switch can be used to turn the light on/off and it looks like a small slider. Slider control: The slider object looks like a bar supplemented with knobs. You can drag the knob to set the value. The slider can be vertical or horizontal. Dropdown control: A drop-down list allows the user to select a value from a list. By default, the drop-down list is turned off and displays a single value or predefined text. The Image control, Imgbtn control, and Label control are described in the previous section.   Control hardware light design Smart home usually has the control of the light, through the control interface to control the hardware light on and off, the steps are as follows: 6.1 GUI Guider generates code project ① Generate the code by clicking the Generate code button. ② Click the Folder icon to open the project folder   6.2 Starting the MDK Project After the generated code is completed, open the project folder and open the MDK project in the specified directory (support MCUXpressoIDE, MDK, IAR).   6.3 First, the drive to control the light switch is added to the project Add a GPIO initializer in lvgl_guider.c.   6.4 then, add a custom Led control function under Custom.c This routine adds Led1_Control, Led2_Control, and Led3_Control lamp control functions.   6.5 Add custom event program to GUI Guider ① Select the first Switch control and add the event. ② In the event, select Trigger to trigger the event condition that the Switch control is on and off, and the Target option is set to Null.  In Action, select C to add custom events and click to open Edit Code.  Add a custom event function to Edit Code (open Led3, close Led2, Led1), and add the header file of the file where the custom event function is located.   6.6 View custom events in the MDK project After setting the custom event, the set Led custom trigger event can be found on events_init.c after the GUI Guider regenerates the code again.   Program download and demo After the project is completed, there are two ways to download the program to the development board: Open the project with IDE (MCUXpresso IDE, KEIL or IAR), compile and download the program to the development board. Selecting MCUXpresso, Keil, or IAR from Target in the GUI Guider automatically compiles the program to download to the board. The following diagram shows how Guider automatically compiles the download program to the development board in GUI.   Attached video shows the effect.   8.In SUMMARY This artical mainly shares the Smart Home interface design based on GUI Guider. GUI Guider, as a tool for GUI design, is powerful and easy to use. This article only uses a few functions of GUI Guider, we can further learn to explore GUI Guider, the related project has been placed in the attachment. The GUI Guider application guide can be found on the NXP official website, and the following are some ways to find information when learning to use GUI Guider. View the User Guide and click Help->User Guide   control Settings and usage instructions, you can click the following small icon to view    
View full article
Note: This document provides a simple description, the details about flashloader can be found at Getting Started with LPC540xx Flashloader User's Guide.pdf which is located in SDK_2.5.0_LPCXpresso54S018\middleware\mcu-boot\doc   Download LPC54S0xx SDK.   Compile the flashloader project to generate flashloader.bin  The project is located in sdk\boards \lpcxpresso54s018\bootloader_examples\flashloader   Use dfu-util.exe or IDE to load flashloader.bin into RAM. dfu-util can be downloaded from http://dfu-util.sourceforge.net/releases/ Configure the ISP pins and then reset the chip to make the chip to enter USB1 DFU boot mode. Boot mode ISP2 PIO0_6 pin ISP1 PIO0_5 pin ISP0 PIO0_4 pin Description USB1 DFU boot LOW LOW HIGH USB DFU class is used to download image over the USB1 high-speed port into SRAM. Connect the LPC54S0xx device USB1 high-speed port and PC with USB. The following is the command line to load the flashloader.bin: $ dfu-util.exe –D flashloader.bin   Use blhost to program/erase LPC540xxM/LPC54S0xxM flash Once the flashloader binary is downloaded and starts its execution on the LPC54S0xx platform and there remains a physical USB connection between the LPC54S0xx platform USB1(High-Speed) and host, the flashloader will be ready to receive the commands. blhost -u 0x1fc9,0x01a2 -- get-property 12 blhost -u 0x1fc9,0x01a2 -- fill-memory 0x2000d000 4 0xc0000004 blhost -u 0x1fc9,0x01a2 -- configure-memory 0xa 0x2000d000 blhost -u 0x1fc9,0x01a2 -- get-property 25 0xa blhost -u 0x1fc9,0x01a2 -t 100000 -- flash-erase-region 0x10000000 0x100000 blhost -u 0x1fc9,0x01a2 -t 100000 -- write-memory 0x10000000 xxx.bin Note: xxx.bin is the target file which needs to be downloaded to the flash.   Author: Hao Liu  Thanks for Hao Liu.
View full article
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
View full article
To help you get started with the LPC800 Mini-Kit, we've put together a few basic resources for you here. LPC800 Mini-Kit Code Base The LPC800 comes populated with an LPC810 MCU in a DIP8 package. The LPC810 package a lot of peripheral punch into a small, extremely affordable package, but as with any deeply embedded device, it's always a challenge to fit the most code and functionality possible into the smallest device available. The LPC810 with 4KB flash and 1KB SRAM is no exception. To help you get started writing light-weight, but easy to understand code in C, we've put together a basic code base for the LPC810 Mini-Kit based around NXP's free LPCXpresso IDE, which uses the free GNU toolchain beneath the surface. The latest version of the code can be viewed and downloaded online on github (LPC810 Code Base), or you can download the latest version directly. Board Schematic The schematics for the LPC800 Mini-Kit are available for download here. See what the LPCWare community did with it! In 2013, NXP ran the LPC800 Simplicity Challenge, and the LPCWare community showed amazing inventiveness in what they created. Check out what they did on our LPC800 campaign pages. Further LPC800 Resources In addition to the LPC800 Mini-Kit Code Base above, you may find some of the following links useful working with the LPC810: LPC810 Product Page on NXP.com LPC800 Switch Matrix Configuration Tool Introducing the LPC800 Videos on YouTube LPC800 Switch Matrix: Making life easier one pin at a time (LPCNow.com) LPC800 LPCXpresso Board Schematics LPCXpresso Forum (for LPCXpresso related support) Tutorial: Getting Started with the LPC810 (Adafruit.com) Programming the LPC800 Mini-Kit with Flash Magic The LPC800 mini board can be programmed using any SWD debugger and your favorite IDE -- NXP's own LPCXpresso, as well as IAR, Keil uVision, and Crossworks for ARM all support the LPC800 out of the box! -- but you can also use an inexpensive UART/USB adapter and ISP mode to program the flash memory on the LPC810. What You'll Need A USB to UART cable or adapter, such as FTDI's popular 'TTL-232R-3V3' cables or a breakout based on the FT232RL chipset The latest version of the free Flash Magic tool​ Configuring the LPC800 Mini Board The first step you will need to do is connect you UART to USB adapter cable to the 'FTDI' header on the top of the LPC800 Mini Board. The pin layout is setup to match FTDI's popular cables by default, specifically the 'TTL-232R-3V3'. Other adapters can of course be used, but you will need to connect the GND, VCC, TXD and RXD pins in the right location yourself. FTDI's TTL-232R-3V3 cable is shown connected here as a reference: LPC800-mini-board The next step is placing the LPC810 in 'ISP' mode. This is accomplished by pulling PIO0_1 'low' during reset, which causes the bootloader to enter ISP mode. The LPC800 mini board conveniently has an 'ISP' switch – the white button in the bottom left-hand side of the board – which we can hold down to pull the ISP pin low. While continuing to press the ISP button, press and then release the 'RESET' button (the red button on the opposite side of the board). This will cause the board to reset, the internal bootloader will see that the ISP pin is low, and it will enter ISP mode where we can program the flash in Flash Magic using the on-chip UART0 peripheral. Configuring Flash Magic for the LPC810 The next step requires you to download and install the latest version of Flash Magic if you haven't already done so. It's available for free at http://www.flashmagictool.com/. Once installed, open the tool, and the run through the following steps: Setup the 'Communications' options: Select LPC810M021FN8 as your target device Set your COM port to whatever port your USB to UART adapter enumerated as (you can find this in the device manager in Windows) Set the Baud Rate to 115200, or whatever matches your USB to UART adapter Make sure that the 'Interface' is set to 'None (ISP)' Set the Oscillator to '12', which matches the speed of the IRC used by the bootloader You can double-check all of your communications settings and connection by selecting the 'ISP > Read Device Signature …' menu item. If you are in ISP mode and properly connected, with the right 'Communications' settings, you should see something similar to the following screen:FlashMagic Device IDIf you get an error message, double check your connections and your settings in Flash Magic, making sure you are actually in ISP mode on the LPC810, and that you've selected the right COM port. Check the 'Erase blocks used by Hex File' checkbox in the 'Erase' section. Select your hex file in the 'Hex File' section: Use the 'Browse' button to point to the Intel Hex file generated by your toolchain or IDE (for example, LPCXpresso). You can also use one of the sample .hex files available here if you don't have a .hex file ready yet. You should end up with Flash Magic configuration as follows ('Verify after programming' is optional): Flash magic settings: Now click the 'Start' button to program the flash … … and finally, once the device has been programmed, reset your board (via the red 'Reset' button). If at some point you want to change your firmware, simply repeat the process of re-entering ISP mode by holding the ISP pin low, resetting the LPC810, releasing the ISP pin, and the programming the device via Flash Magic again. Known issues There is an issue with some of the LPC810 DIP8 parts that are populated on the mini board that prevents the analog comparator from functioning. To see if the part on your board is affected, locate the date code on the top of the DIP8 package (the last line of text on top of the chip). If this line end with either "2X" or "2A", your part is affected. LPC800 mini board schematics Rev AR2.pdf - Attached
View full article
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!
View full article
This article is about how to use MCUXpresso Config Tool to create a USB project from start. The method is the same to all MCUXpresso Config Tool supported MCUs Demo: Creating USB composite HID mouse + keyboard project. Prequisities: LPCXpresso55S69-EVK MCUXPresso IDE 11.1.1 SDK package for LPCXpresso55S69 ,SDK_2.7.1_LPCXpresso55S69. The SDK has to be imported into MCUXPresso IDE (in Installed SDKs). Step by step guide is attached. Enjoy it :-).
View full article
The OM13043 kit described below is no longer available (the LPC1227 and LPC1100XL devices are still available). This material is provided for reference materials, but KNX software is still available from Weinzierl Engineering. Building automation systems based on KNX communication protocols Communication is becoming essential in complex buildings. For this reason, NXP cooperates with Weinzierl Engineering to offer dedicated components to realize KNX based systems. A professional version of the KNX system B stack is now available on LPC Microcontrollers to allow a jump start with KNX development. System notes LPC1100XL and LPC1200 series microcontrollers: Based on the highly energy-efficient ARM® Cortex™-M0 processor Dramatically lower the cost per KNX node in home and building automation networks Cortex-M0 architecture ideally suited for low-complexity end nodes Include up to 128 KB Flash and 8 KB SRAM, and offer highly configurable peripherals Can be powered directly from the DC-DC converter of the KNX twisted-pair transceivers, making bus-powered devices easy to implement With performance levels up to 45 DMIPS, a single MCU delivers the resources required to run a KNX System B stack (up to 65535 nodes), with enough bandwidth available for the end application Reduced time to market – full professional stack available from partners with flexible license models A certified implementation of the KNX System B is available for the LPC1200 from Weinzierl Engineering  Implementation example (OM13042 demo board): Available with the NXP LPC1227 microcontroller and ON Semiconductor’s NCN5120 transceiver, suitable for use in KNX twisted pair networks (KNX TP1-256) Specifically designed to simplify design process with a ready-to-implement, energy-efficient KNX TP solution for applications such as lighting switches and control, HVAC control, shutters and occupancy detection Improves power efficiency, reduces development costs, accelerates time to market for KNX applications on ARM Cortex-M0 Application Note AN11231 is available here More information on KNX:  www.knx.org KNX TP Stack System B from Weinzierl Engineering - The new dimension of KNX development Each KNX device is based on a device model, that specifies both the management procedure (that is, how the device is configured via the bus) and identifies the resources available to the device (for example, the maximum size of the connection table). System B (mask version 07B0) is a new device model that has been defined specifically for the implementation of complex KNX devices. The main advantage lies in the number of available communication objects. While previous devices models were limited to 255 objects or less, System B theoretically permits up to 65,535 communication objects. To achieve this, the formats of the communication tables (group address, association and group object tables) have been redefined in the KNX specification for System B. System B devices can update their communication objects at system startup. This function is called Read-On-Init and can be activated individually for each object. Once the application is started the system software sends group read-value services independent from the application task. These services are scheduled by the stack to ensure that the bus is not excessively loaded at startup. System B also offers a greatly increased address space. The configuration data (application, parameters and tables) can be loaded into a range of up to 1 MB (20-bit addressing) via the bus (using memory services). To access system parameters, additional properties in the interface objects of the system have been introduced. System B is supported by the ETS manufacturer tool MT4, by ETS3 andETS4. Implementation for optimal performance Weinzierl Engineering as a KNX system supplier offers a new implementation for KNX System B, specifically targeted at complex devices with a 32-bit architecture like the Cortex M0 from NXP. It includes a complete implementation of the specification and is optimized to ensure high performance for all application sizes. A major consideration in the development of System B is the timely (real-time) processing of the large association table, which contains the assignment of group addresses to the communication objects and vice versa. It is loaded by ETS and is not sorted. For a table length of more than a thousand entries, linear search algorithms are not effective and therefore additional look-up tables have been introduced that allow quick access via indices. The processing of the communication objects has also been accelerated and a linear search through all objects is avoided with the use of additional buffers. Although these design features may require additional memory, they facilitate low CPU clock speeds. Higher performance is achieved at the same frequency with than with previous implementations with considerably reduced KNX resources. The System B implementation from Weinzierl Engineering uses a virtual address space that is resolved at the driver level and mapped to the corresponding physical storage areas. This means that applications are easily ported to different platforms. As for all Weinzierl's stack implementations, the focus is to ensure ease of application development. The application interface has been largely maintained and is accessible via comprehensive API functions. It is possible to implement either internal or external applications. An internal application is bundled together with the stack in the device and the ETS simply has to load the parameters and tables, which ensures quick download times. An external application is loaded by the ETS along with the parameters and tables. The stack also supports additional interface objects (user properties). These objects can be used, for example, to set device parameters using point-to-point communication on the bus. ETS parameters can also be realized with Properties. For the creation of the product data base with ETS MT4 (Manufacturer Tool) our bus monitor and KNX development tool Net'n Node has been extended with a new export function. After importing the data of the software project it directly generates an XML file that contains all the storage areas, load controls and binary application data. This XML file can be imported directly into the MT4 solution.
View full article
This document was made to explain how to regain control of any LPC EVK on brick mode without using an external debugger. Explore the simple way. In some cases, this method forms well and is the easy way, open your IDE and select your project.   At this point you may have a debugger configuration of your last debug session, so, you have similar icons to the image. Open the tab below and select erase. Depending on your debugger configuration you need to select the same icons below. Note: In some cases will be necessary to put your MCU in ISP. And that’s all, could try if the MCU is out the brick mode.   Introduction First, you need to install these tools on your PC. LPCScrypt [LPCScrypt v2.1.2 | NXP Semiconductors]. J-Link Commander. [J-Link Commander (segger.com)]. To understand this document, we need to know that every EVK [Evaluation Kit] can be divided into 2 parts. The debugger on the board Link2 and the target LPC55sXX. Figure 1. Link2 Green square, LPC55sXX Red square This document will describe two methods that must be done in the order mentioned because we will see how to update the firmware of the debugger to use the same board for a self-recovery, this step is necessary for the tool J-Link Commander to recognize the debugger as a Segger probe, then when the update is done the second step should be to enter ISP mode to do a mass erase of the target to get out of the brick mode. Link2 The Link 2 (LPC4370) debugger on the board probe can be configured to support various development tools and IDEs using a variety of different downloadable firmware images. Available firmware images include: J-Link by Segger. LinkServer. By default, the EVK board has the firmware LinkServer on the LPC4322 (dependent on your board), for this proposal we will see how to change to J-Link On-Board. DFU The EVK needs to be prepared to receive this firmware on the debugger, to do that we need to put the board on DFU [Device Firmware Update]. On the schematic need to find the DFU jumper to put on the board, the image below is an example of different EVKs check Figure 2.   Figure 2. DFU from different boards. Then connect it to the PC. Note: The firmware update is completely reversible. LPCScrypt Once installed on the PC we need to locate these files of the installation. Root example: C:\nxp\LPCScrypt\scripts When you have the board on DFU, connecting the USB Llink2 to the PC and then RUN the Scrypt (program_JLINK) in CMD check Figure 3. Press any key to continue… Figure 3. Flash firmware of J-Link in DFU mode. Successfully done, at this moment the EVK has the firmware of J-Link Segger. Review the Figure 4. Figure 4. The firmware was flashed successfully. Remove the USB cable to remove the DFU jumper with the board unpowered. ISP Brief of ISP (In System Programming) this method is used to recover a part programmed with a corrupted image which is not detectable by ROM. So, to enter this mode the user needs to put a jumper in the ISP header pins, search for this in the schematic, then connect to the PC and check Figure 5.     Figure 5. ISP image examples from different boards. J-LINK Commander Open the software and if the communication is right the message will appear J-Link via USB… OK check Figure 6. Figure 6. The EVK is now communicating to the tool J-Link Commander. Commands To start the communication needs to send the command “connect”. Then the tool shows your last target (if you use it) and use the next command “?” to change the target review Figure 7. Figure 7. Review the target. In the new popup window in the green area, you need to put the name of the target, take care you do not put the debugger check Figure 8. Figure 8. In the green area, you need to put the matricula of the MCU target. Example [LPC55s16 or LPC55s69] depending of your target check Figure 9. Figure 9. If the tool supports the MCU will show below the red square. In the next selections the tool is asking for the interface of communication, the communication of the EVK is SWD, and for that write “S” as SWD. On speed, only click enter without entry. Then this will appear before the connection check Figure 10. Figure 10. The communication is Done. Then use the command “erase” like the Figure 11. Figure 11. The tool indicate the erase is done. Finally disconnect the USB and remove the ISP jumper, then open the IDE and test the blinky led example, or if you wanted you could use the BLHOST. Flashing the MCU using  BLHOST. At this step you could able to use the IDE or use BLHOST. You could install SPSDK if you wanted [Installation Guide — SPSDK documentation]. In ISP mode… blhost -p COMxx  get-property 1 Figure 12. The first command is to check the communication. blhost -p COMxx flash-erase-all Figure 13. Do a mass erase. blhost -p COMxx write-memory 0 C:\root_example\Debug\led_blinky.bin Figure 14. The flashing was done. Remove the ISP jumper and reset your device. Common error LPCScrypt If the message appears “Nothing to boot”, need to be sure the board is connected to the PC with the DFU mode in LINK 2 check Figure 16. Figure 16. The red square is an example of an error communication. J-Link Commander If a similar message appears, “Cannot connect to target”, need to put the target in ISP mode, and return to the first steps with J-Link commander check Figure 18. Figure 18. Show how the communication is not done.
View full article
The documentation discusses how to generate phase-shift PWM signals based on SCTimer/PWM module, the code is developed based on MCUXpresso IDE version 10.3 and LPCXpresso5411x board. The LPC family has SCTimer/PWM module and CTimer modules, both of them can generate PWM signals, but only the SCTimer/PWM module  can generate phase-shift PWM signals. In the code, only the match registers are used to generate events, I/O signals are not used.  The match0 register is set up as (SystemCoreClock/100), which determines the PWM signal frequency. The the match1 register is set up as 0x00, which generate event1. The the match2 register is set up as (SystemCoreClock/100)/2;, which generate event2. The duty cycle is (SystemCoreClock/100)/2-0x00= (SystemCoreClock/100)/2, which is 50% duty cycle, the cycle time is (SystemCoreClock/100). The event1 sets the SCT0_OUT1, event2 clears the SCT0_OUT1, so SCT0_OUT1 has 50% duty cycle. The the match3 register is set up as (SystemCoreClock/100)/4;, which generate even3. The the match4 register is set up as 3*(SystemCoreClock/100)/4, which generate event4. The duty cycle is 3*(SystemCoreClock/100)/4  -  (SystemCoreClock/100)/4= (SystemCoreClock/100)/2, which is 50% duty cycle. The event3 sets the SCT0_OUT2, event4 clears the SCT0_OUT2, so SCT0_OUT2 has 50% duty cycle. The phase shift is (SystemCoreClock/100)/4 - 0x00= (SystemCoreClock/100)/4, which corresponds 90 degree phase shift. PWM initilization code: //The SCT0_OUT1 can output PWM signal with 50 duty cycle from PIO0_8 pin //The SCT_OUT2 can output PWM signal with 50 duty cycle fron PIO0_9 pin //The SCT0_OUT1 and SCT0_OUT2 PWM signal has 90 degree phase shift. void SCT0_PWM(void) {     SYSCON->AHBCLKCTRL[1]|=(1<<2); //SET SCT0 bit     SCT0->CONFIG = (1 << 0) | (1 << 17); // unified 32-bit timer, auto limit     SCT0->SCTMATCHREL[0] = SystemCoreClock/100; // match 0 @ 100 Hz = 10 msec     SCT0->EVENT[0].STATE = 0xFFFFFFFF; // event 0 happens in all states     //set event1     SCT0->SCTMATCHREL[1]=0x00;     SCT0->EVENT[1].STATE = 0xFFFFFFFF; // event 1 happens in all states     SCT0->EVENT[1].CTRL = (1 << 12)|(1<<0); // match 1 condition only     //set event2     SCT0->SCTMATCHREL[2]=(SystemCoreClock/100)/2;     SCT0->EVENT[2].STATE = 0xFFFFFFFF; // event 2 happens in all states     SCT0->EVENT[2].CTRL = (1 << 12)|(2<<0); // match 2 condition only     //set event3     SCT0->SCTMATCHREL[3]=(SystemCoreClock/100)/4;     SCT0->EVENT[3].STATE = 0xFFFFFFFF; // event 3 happens in all states     SCT0->EVENT[3].CTRL = (1 << 12)|(3<<0); // match 3 condition only     //set event4     SCT0->SCTMATCHREL[4]=3*(SystemCoreClock/100)/4;     SCT0->EVENT[4].STATE = 0xFFFFFFFF; // event 4 happens in all states     SCT0->EVENT[4].CTRL = (1 << 12)|(4<<0); // match 4 condition only     //PWM output1 signal     SCT0->OUT[1].SET = (1 << 1); // event 1 will set SCT1_OUT0     SCT0->OUT[1].CLR = (1 << 2); // event 2 will clear SCT1_OUT0     SCT0->RES |= (3 << 2); // output 0 toggles on conflict     //PWM output2 signal     SCT0->OUT[2].SET = (1 << 3); // event 3 will set SCT1_OUT0     SCT0->OUT[2].CLR = (1 << 4); // event 4 will clear SCT1_OUT0     SCT0->RES = (3 << 4); // output 0 toggles on conflict     //PWM start     SCT0->CTRL &= ~(1 << 2); // unhalt by clearing bit 2 of the CTRL } Pin initialization code: //PIO0_8 PIO0_8 FC2_RXD_SDA_MOSI SCT0_OUT1 CTIMER0_MAT3 //PIO0_9 PIO0_9 FC2_TXD_SCL_MISO SCT0_OUT2 CTIMER3_CAP0 - FC3_CTS_SDA_SSEL0 void SCTimerPinInit(void) {     //Enable the     SCTimer clock     SYSCON->AHBCLKCTRL[0]|=(1<<13); //set IOCON bit     //SCTimer pin assignment     IOCON->PIO[0][8]=0x182;     IOCON->PIO[0][9]=0x182;     IOCON->PIO[0][10]=0x182; } Main Code: #include <stdio.h> #include "board.h" #include "peripherals.h" #include "pin_mux.h" #include "clock_config.h" #include "LPC54114_cm4.h" void SCT0_Init(void); void SCTimerPinInit(void); void P1_9_GPIO(void); void SCT0_PWM(void); int main(void) {       /* Init board hardware. */     BOARD_InitBootPins();     BOARD_InitBootClocks();     BOARD_InitBootPeripherals();     printf("Hello World\n");    // SCT0_Init();    // P1_9_GPIO();     SCTimerPinInit();     SCT0_PWM();     /* 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 ; } The Yellow channel is PIO0_8 pin output signal, which is SCT0_OUT1 PWM output signal. The Bule channel is PIO0_9 pin output signal, which is SCT0_OUT2 PWM output signal.
View full article