Arm Keil MDK v6 Essential and Professional editions are now available to buy as monthly or annual subscriptions from our Developer Tools store. Visit the store to get access to the tools suite today!

  1. Boards
  2. LPCXpresso54102

LPCXpresso54102

NXP
LPCXpresso54102
VSCode with the Arm Keil Studio extension

Accelerate your application development with example projects

Import your chosen project to Keil Studio for VS Code or Keil Studio Cloud, or download for use in Keil uVision.

Learn more about Keil tools
  • lpc_spi_dma_b2b_transfer_master

    µVision AC5

    The spi_dma_b2b_transfer_master example shows how to use driver API to transfer in DMA way. In this example, one spi instance as master and another spi instance on the other board as slave. Master sends a piece of data to slave, and receive a piece of data from slave. This example checksif the data received from slave is correct. This example needs to work with spi_dma_b2b_transfer_slave example.Note: This example will run in master mode, please prepare another board for slave, and the slave board should be started first.Project Information1.How to set the baudrate of SPI? The baudrate of SPI is easy to set, just make sure the source clock of SPI. The formula is below: baudrate = PCLK_SPIn / DIVVAL SPIn->DIV = DIVVAL -1 For example, if the needed baudrate of SPI is 500khz, and the SPI clock is 12MHz DIVVAL = 12000000/500000 DIVVAL = 24 SPIn->DIV = DIVVAL -1 = 23Program Flow:Main routine: 1.Initialize the hardware. Configure pin settings, clock settings by using BOARD_InitHardware(); 2.Send information to terminal by using debug console. 3.Initialize the SPI with configuration. 4.Set up DMA configuration for master SPI. Initialize DMA and DMA channel setting(create handle and set callback) for both SPI RX and TX, set prioritory for TX channel and RX channel. 5.Start SPI master transfer in DMA way. Initialize buffers and start SPI transfer in DMA way. 6.Check if data from master is all right. Waiting for transmission complete, print received data and log information to terminal. 7.De-initialize the SPI and DMA.

    Download Pack
  • lpc_spi_dma_b2b_transfer_slave

    µVision AC5

    The spi_dma_b2b_transfer_slave example shows how to use driver API to transfer in DMA way. In this example, one spi instance as master and another spi instance on the other board as slave. Master sends a piece of data to slave, and receive a piece of data from slave. This example checksif the data received from master is correct. This example needs to work with spi_dma_b2b_transfer_master example.Note: This example will run in slave mode, please prepare another board for master, and the slave board should be started first.Project InformationProgram Flow:Main routine: 1.Initialize the hardware. Configure pin settings, clock settings by using BOARD_InitHardware(); 2.Send information to terminal by using debug console. 3.Initialize the SPI with configuration. 4.Set up DMA configuration for slave SPI. Initialize DMA and DMA channel setting(create handle and set callback) for both SPI RX and TX, set prioritory for TX channel and RX channel. 5.Start SPI master transfer in DMA way. Initialize buffers and start SPI transfer in DMA way. 6.Check if data from master is all right. Waiting for transmission complete, print received data and log information to terminal. 7.De-initialize the SPI and DMA.

    Download Pack
  • lpc_spi_half_duplex_dma_master

    µVision AC5

    The lpc_spi_half_duplex_dma_transfer_master example shows how to use driver API to transfer in half-duplex way. In this example, one spi instance as master and another spi instance on the other board as slave. Master sends a piece of data to slave, and receive a piece of data from slave. This example checks if the data received from slave is correct.Besides, master will transfer data in DMA way.

    Download Pack
  • lpc_spi_half_duplex_dma_slave

    µVision AC5

    The lpc_spi_half_duplex_dma transfer_slave example shows how to receive and transmit data to master board.Notice: The SPI slave of this example uses dma mode. The data transfer size(not buffer size) is twice ofthe master's transfer size. The first half of the transmission will receive data, and the second half will senddata back to master, so the address of the receive buffer is &rxDataPolling[64].In this example, one spi instance as slave and another spi instance on the other board as master. Master sends a piece of data to slave, and receive a piece of data from slave. This example checks if the data received from master is correct. And slave will print what it received.

    Download Pack
  • lpc_spi_half_duplex_int_master

    µVision AC5

    The lpc_spi_half_duplex_int_transfer_master example shows how to use driver API to transfer in half-duplex way. In this example, one spi instance as master and another spi instance on the other board as slave. Master sends a piece of data to slave, and receive a piece of data from slave. This example checks if the data received from slave is correct.Besides, master will transfer data in interrupt way.

    Download Pack
  • lpc_spi_half_duplex_int_slave

    µVision AC5

    The lpc_spi_half_duplex_int_transfer_slave example shows how to receive and transmit data to master board.Notice: The SPI slave of this example uses interrupt mode. The data transfer size(not buffer size) is twice ofthe master's transfer size. The first half of the transmission will receive data, and the second half will senddata back to master, so the address of the receive buffer is &rxDataPolling[64].In this example, one spi instance as slave and another spi instance on the other board as master. Master sends a piece of data to slave, and receive a piece of data from slave. This example checks if the data received from master is correct. And slave will print what it received.

    Download Pack
  • lpc_spi_half_duplex_polling_master

    µVision AC5

    The lpc_spi_half_duplex_polling_transfer_master example shows how to use driver API to transfer in half-duplex way.In this example, one spi instance as master and another spi instance on the othere board as slave. Master sends a piece of data to slave, and receive a piece of data from slave. This example checks if the data received from slave is correct.Besides, master will transfer data in polling way.

    Download Pack
  • lpc_spi_half_duplex_polling_slave

    µVision AC5

    The lpc_spi_half_duplex_polling_transfer_slave example shows how to receive and transmit data to master board.Notice: The SPI slave of this example uses interrupt mode. The data transfer size(not buffer size) is twice ofthe master's transfer size. The first half of the transmission will receive data, and the second half will senddata back to master, so the address of the receive buffer is &rxDataPolling[64].In this example, one spi instance as slave and another spi instance on the other board as master. Master sends a piece of data to slave, and receive a piece of data from slave. This example checks if the data received from master is correct. And slave will print what it received.

    Download Pack
  • lpc_spi_interrupt

    µVision AC5

    The spi_interrupt example shows how to use spi functional API to do interrupt transfer:In this example, one spi instance as master and another spi instance as slave. Master sends a piece of data to slave,and check if the data slave received is correct.

    Download Pack
  • lpc_spi_interrupt_b2b_master

    µVision AC5

    The spi_interrupt_b2b_master example shows how to use spi functional API to do interrupt transfer as a master:In this example, the spi instance as master. Master sends a piece of data to slave, receive data from slave,and checkif the data master received is correct. This example needs to work with spi_interrupt_b2b_slave example.

    Download Pack