pw_spi_mcuxpresso#

Pigweed AI summary: The pw_spi_mcuxpresso module implements the pw_spi interface using the NXP MCUXpresso SDK. It provides two implementations for the SPI and FLEXIO_SPI drivers in the SDK, with options for blocking or non-blocking transfer methods. The setup process involves setting up the MCUXpresso SDK for use with Pigweed and including the GPIO and PINT driver components. An example SDK setup for an RT595 EVK is provided. To use the module, the pw_third_party_mcuxpresso_SDK

pw_spi_mcuxpresso implements the pw_spi interface using the NXP MCUXpresso SDK.

There are two implementations corresponding to the SPI and FLEXIO_SPI drivers in the SDK. SPI transfer can be configured to use a blocking (by polling) method or non-blocking under the covers. The API is synchronous regardless.

Setup#

Pigweed AI summary: To set up the MCUXpresso SDK for use with Pigweed, follow the steps in the pw_build_mcuxpresso module. This involves creating a pw_source_set for an MCUXpresso SDK and including the GPIO and PINT driver components in the SDK definition. The provided example demonstrates the setup for an RT595 EVK. Additionally, you need to specify the pw_third_party_mcuxpresso_SDK GN global variable to specify the name of this source set and edit your GN args. Finally, depend

Use of this module requires setting up the MCUXpresso SDK for use with Pigweed. Follow the steps in pw_build_mcuxpresso to create a pw_source_set for an MCUXpresso SDK. Include the GPIO and PINT driver components in this SDK definition.

This example shows what your SDK setup would look like if using an RT595 EVK.

import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni")

pw_mcuxpresso_sdk("sample_project_sdk") {
  manifest = "$dir_pw_third_party/mcuxpresso/evkmimxrt595/EVK-MIMXRT595_manifest_v3_8.xml"
  include = [
    "component.serial_manager_uart.MIMXRT595S",
    "platform.drivers.flexio_spi.MIMXRT595S",
    "platform.drivers.flexspi.MIMXRT595S",
    "project_template.evkmimxrt595.MIMXRT595S",
    "utility.debug_console.MIMXRT595S",
  ]
}

Next, specify the pw_third_party_mcuxpresso_SDK GN global variable to specify the name of this source set. Edit your GN args with gn args out.

pw_third_party_mcuxpresso_SDK = "//targets/mimxrt595_evk:sample_project_sdk"

Then, depend on this module in your BUILD.gn to use.

deps = [ dir_pw_spi_mcuxpresso ]

Example#

Pigweed AI summary: This paragraph provides an example of using the FLEXIO_SPI initiator. It shows the code for initializing the initiator, configuring it, and performing a write-read operation.

Example write using the FLEXIO_SPI initiator:

McuxpressoFlexIoInitiator spi(
   flexio_spi_config, CLOCK_GetFlexioClkFreq(), baud_rate_bps, blocking);
spi.Configure(configuration);

spi.WriteRead(source, destination);