Multi Source Translation Content

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

Multi Source Translation Content

讨论

排序依据:
Flexioを特殊なSPIとして、同時に20ビットMOSI出力として動作させたい。 csとclkは共有されます。 20本のMOSIラインが20本のDACチップに接続されていますが、この環境下でFlexio Muilt-BeatはCAN動作しますか? 通信・制御(I3C |I2C |SPI |FlexCAN |イーサネット |FlexIO) Re: I want to use flexio to work as a special spi, 20bit mosi output at the same time 私が使用したチップはMCN947です。 FlexIOを使用して、24ビットDACを20個SPI制御するシミュレーションを行う必要があります。 これら20個のDACのCSおよびCCKパラメータは共通ですが、各チップはそれぞれ独立したMOSIを備えています。MISOは存在しません。したがって、厳密に言えばSPIではなく、20個のMOSIを備えたSPIと言えます。 出力が生成されるたびに、20個のDACの値が同時に更新される。 私の考えは、20個のDACから1ビットずつSHIFBUFに格納し、8個のSHIFBUFでそれぞれ8ビットを格納するというものです。 1回のDMA転送で、20個のDACに対する8ビットデータの更新が完了する。 DMA処理では、24ビットのデータを3回同期および更新します。最後に、チップセレクト信号が立ち上がります。 アイデアはあったものの、Flexioのサンプルコードを見ても、どこからコードを書き始めればいいのか分からなかった。 関連する事例をお持ちかどうか分かりません。また、私のやり方が最適かどうかも分かりません。 Re: I want to use flexio to work as a special spi, 20bit mosi output at the same time こんにちは@justdomyself 質問についてもう少し詳しく説明していただけますか? お知らせください: どのMCUを使っているのか教えてください。 ソフトウェアの設定方法。 どのような問題が発生していますか? 問題の理解に役立つ可能性のある追加情報があれば教えてください。 中国語で問題を説明していただいても構いません。 よろしくお願いします。 BR アリス Re: I want to use flexio to work as a special spi, 20bit mosi output at the same time こんにちは@justdomyself ご返信ありがとうございます。 申し訳ありませんが、 20個のMOSI出力でDACを駆動するMCXN947のサンプルはご用意しておりません。利用可能なFlexIOの例は主に標準的なSPIインターフェースをエミュレートするよう設計されています。 あなたのアプリケーションでは、ご自身の特定の要件に基づいたカスタムFlexIOドライバを開発する必要があるでしょう。 以下の例を参考にしてください。 AN14175: FlexIOを使ってQuad SPIコントローラをエミュレートする方法 |NXP Semiconductors よろしくお願いします。 BR アリス
查看全文
PFS8632寄存器映射 在哪里可以找到登记地图 Re: PFS8632 register map 你好,哈拉尔德, PFS8632 是 FS86 功能安全 SBC 系列的一部分。详细的寄存器映射可在 FS86 产品页面的“文档/安全”部分下的完整 FS86 数据表中找到。访问需要 NXP 帐户和NDA/安全文件批准。   BRs,托马斯
查看全文
PFS8632 register map where to find the regsiter map  Re: PFS8632 register map Hello Harald, The PFS8632 is part of the FS86 Safety SBC family. The detailed register map is available in the full FS86 datasheet under the Documentation/Secure section of the FS86 product page. Access requires an NXP account and NDA/secure-file approval.   BRs, Tomas
查看全文
NFC Reader Library Migration to FRDM-MCXN947 Introduction. This document provides a guide on how to use the NFC frontend PN5190 with the FRDM-MCXN947 and using the latest existing version of the NFC Reader Library. The hardware required to follow this guide is: FRDM-MCXN947 development board as host MCU. PNEV5190BP (based on PN5190) as the NFC transceiver Software Setup. MCXN947 SDK version: 26.06.00 NFCReaderLibrary version: 07.16.00 PN5190 FW version: 0x20D MCUxpresso IDE version: 25.6 Hardware connections. The PNEV5190 comes with a Kinetis K82F as a host MCU to drive the PN5190 Since the goal is to drive PN5190 from the MCXN947 via SPI, we need to prepare the PNEV5190 for it: Power up board correctly Enable external SPI pins Disable K82F interface with PN5190 Power up and jumper configuration To power up the board correctly: – Powering it up over USB does not provide enough current. It will be powered with an external power supply of 7.5V over connector J17. Put jumper on following pins: – J9 2-3: External power supply – J8: VBATPWR supplied with VBAT=3.3 V – J12: VBAT supplied with 3.3 V Remove jumpers on following pins: – J22, J23: open SDA signals for K82F – J19: RTS push-button bypass for K82F – J3, J4, J5, J6: pull down jumpers for NFC module signals Set GPIO and SPI voltage to 3.3 V: supplying 3.3 V to VDDIO and the μC supply: – Remove short circuit on R19 – Place short circuit on R20 For any additional configuration, please see PNEV5190B evaluation board quick start guide. Location of the changes mentioned above can be seen in the following image: Habib_MS_0-1781132345846.png Routing NFC module communication pins to JP1 To enable the pins on JP1 for communication, we must enable bus switch U10 and disable bus switch U12 in the NFC Host Interface. These switches enable or disable the connections from K82 to PN5190 SPI pins, and expose the SPI interface to an external host. Remove short on R5 to disable communication routing to K82F. Place short on R7 to enable communication routing to JP1 pins. Habib_MS_2-1781132571269.png For FRDM-MCXN947 side, no modifications are necessary.  The pins used are available in Header J1 and J2. Which are shown in the following table.   Name MCXN947 PN5190 SCK J2.12 JP1.1 MOSI J2.8 JP1.2 MISO J2.10 JP1.3 SSEL J2.6 JP1.4 IRQ J1.16 JP1.5 RESET J2.2 JP6.1 GND J2.14 JP1.10 SUCCESS J2.17* FAIL J2.15* DWL J2.13* * Pins that need to be configured for library compatibility but are not used and do not need to be connected. Software Changes This section describes the software changes required to run the “NfcrdlibEx1_DiscoveryLoop” example from the NFC Reader Library which consists in a detection loop that displays in a terminal information (like UID, SAK, and Product Type for MIFARE product-based cards) about any tag detected by the PN5190. Please download the NFC Reader Library for PN5190 from NFC Reader Library | NXP Semiconductors. To begin with the migration, we first need to create a project with the FRDM-MCXN947 SDK (v26.06.00), for this purpose download and install the FRDM-MCXN947 SDK from the SDK Builder. Importing NFC Reader Library Click on “File” from upper tab menu and “Import…”. In the Import wizard, select “Existing Projects into Workspace”. In the “Select root directory” search the directory where the downloaded library is located and click on Finish (do not check the “Copy projects into workspace” option). Habib_MS_0-1781133143312.png Note: If the K82 SDK is not installed an error message will appear, please click on cancel. Habib_MS_0-1782234443148.png Creating base project 1. In the Quick Start panel click on “import SDK example(s)…” in the MCUXpresso IDE. 2. Select “frdmmcxn947” and click on next. Habib_MS_1-1781133200020.png 3. Select the SDK example “hello_world_cm33_core0” and click on finish. Habib_MS_2-1781133254045.png 4.Now we will add the required drivers for migration, which are SPI and CTIMER drivers. . Click on properties-> SDK Management-> Manage SDK Components. Habib_MS_3-1781133444305.png 5. Search in the filter bar “ctimer” and “lpspi” and check their boxes to add them and click on OK. Habib_MS_5-1781133510047.png Habib_MS_6-1781133576098.png Add the source code Discovery Loop Example From the imported example NfcrdlibEx1_DiscoveryLoop_mcux of the NFC Reader Library, find and copy the following files (included in src folder): NfcrdlibEx1_EmvcoProfile.c, phApp_Helper.c, phApp_Init.c, phApp_PN5190_Init.c; and paste them into the source folder inside the created base project. Additionally, delete the file hello_world .c created by the project. Habib_MS_0-1781134009079.png             Habib_MS_1-1781134021054.png Additionally, we need to add the file “NfcrdlibEx1_DiscoveryLoop.c” which is the main source file of the project, to do this right-click on the “source” folder of our project and then put the cursor on “New” and select “File”. Habib_MS_2-1781134090137.png In the tab that will open, write the name of the file (NfcrdlibEx1_DiscoveryLoop.c) and then, click on “Finish”. Habib_MS_3-1781134114470.png Finally, in the created file copy and paste all the code inside the original source file located in the library example. Habib_MS_4-1781134170782.png Habib_MS_5-1781134196935.png Link the NFC Reader Library elements To make the required software changes, we need to link the DAL, NxpNfcRdLib, phOsal and intfs folders into the base project, to do this: 1. In the Project Explorer, right click on the project and place your cursor on New and click on Folder. 2. In the New Folder tab, click on “Advanced >>” and select “Link to alternate location (Linked Folder)” and on “Browse…”. Habib_MS_6-1781134337471.png 3. Browse into the path where the library was extracted, choose the NxpNfcRdLib folder and click on Finish. Habib_MS_7-1781134383646.png 4. Do the same procedure for “Platform/DAL”, “Examples/NfcrdlibEx1_DiscoveryLoop/intfs” and “RTOS/phOsal” folders. If you have the folder in the same project explorer, the included folder will not appear, but you can see it when you open the window to add another folder, as shown in the following figure. Habib_MS_8-1781134451238.png But if the included folders are not in the Project Explorer, the Project should look like this: Habib_MS_9-1781134500816.png Once this is done, we will need to delete the “KinetisSDK” folder located in “DAL > src” to avoid multiple definition issues. Habib_MS_10-1781134521814.png Define FRDM-MCXN947 SDK preprocessor symbol We need to do some changes to the compiler preprocessor configuration. 1. Right click on the project in the Project Explorer and click on “Properties… Habib_MS_0-1781134734232.png 2. In the properties tab, go to “C/C++ Build > Settings > MCU C Compiler > Preprocessor”. The symbols are related with the FRDM board, but we need to add the following symbols related with the NFC Reader Library: PH_OSAL_NULLOS PHDRIVER_FRDMMCXN947_PN5190_BOARD NXPBUILD_CUSTOMER_HEADER_INCLUDED PHDRIVER_MCXN947_SPI_POLLING Habib_MS_1-1781134774044.png Click on the “Add...” button at the top right corner of the “Defined symbols (-D)” menu and enter each symbol mentioned before. Habib_MS_0-1782235762579.png These symbols are added so the preprocessor knows which header files to include at build time. PHDRIVER_FRDMMCXN947_PN5190_BOARD will help include the BoardSelection.h header, the file that is going to define addresses for registers and peripherals of MCXN947. PH_OSAL_NULLOS will include headers related to non-OS operation, meaning that the project will work without any operative system (at the end of this guide you will find the steps to add FreeRTOS support). NXPBUILD_CUSTOMER_HEADER_INCLUDED will add headers to add and select the NFC reader and host that will be used in the project. PHDRIVER_MCXN947_SPI_POLLING if is defined the example will perform SPI communication by polling method, and if not, will be perform through non-blocking transfers. 3. Once added, click on “Apply and Close”, "Rebuild Index" and then to “Yes” to save the changes. Modifying the Driver Abstraction Layer (DAL) The added linked folder DAL will contain the important changes to be able to use the MCXN947 as host device since it will contain all the changes regarding SPI, timer and GPIO configurations required by the library to work properly. Board_FRDM_MCXN947_PN5190.h We need to create a header file that will contain important macros used by the library that are related to the host specific SPI, timer and GPIO peripherals, as well as interrupt vectors and priorities, clock sources and addresses. This file is required to be inside the “boards” folder which is inside DAL. Please add the header file as the file created NfcrdlibEx1_DiscoveryLoop.c but replacing .c to .h: Habib_MS_1-1782236163267.png Habib_MS_0-1781196980059.png The file should be named as shown in the picture above. Inside this file, some important macros related to the SPI peripheral and the important pins to be handled (IRQ, Chip Select, Reset) are defined. Habib_MS_1-1781196999826.png Spoiler (Highlight to read) #ifndef DAL_BOARDS_BOARD_FRDM_MCXN947_PN5190_H_ #define DAL_BOARDS_BOARD_FRDM_MCXN947_PN5190_H_ #define GPIO_PORT 0 #define GPIO_PORT1 1 /****************************************************************** * LPSPI clock configuration ******************************************************************/ /*Clock Frequency for SPI Flexcomm 1*/ #define SPI_CLOCK_FREQ (CLOCK_GetLPFlexCommClkFreq(1u)) #define SPI_MASTER_CLOCK_FREQ SPI_CLOCK_FREQ /****************************************************************** * Board Pin/Gpio configurations ******************************************************************/ #define PHDRIVER_PIN_RESET ((GPIO_PORT << 8) | 28) /**< Reset pin, Pin28, PIO0_28 */ #define PHDRIVER_PIN_IRQ ((GPIO_PORT << 8) | 31) /**< IRQ pin, Pin10, PIO0_10 */ /* For 5190 busy is same as IRQ */ #define PHDRIVER_PIN_BUSY ((GPIO_PORT << 8) | 31) /**< IRQ pin, Pin31, PIO0_31 */ #define PHDRIVER_PIN_DWL ((GPIO_PORT << 8) | 19) /**< Download pin, Pin19, PIO0_19*/ /* These pins are used for EMVCo Interoperability test status indication, * not for the generic Reader Library implementation. */ #define PHDRIVER_PIN_SUCCESS ((GPIO_PORT1 << 8) | 0) /**< GPIO, Port 1, Pin0 */ #define PHDRIVER_PIN_FAIL ((GPIO_PORT1 << 8) | 1) /**< GPIO, Port 1, Pin1 */ /****************************************************************** * PIN Pull-Up/Pull-Down configurations. ******************************************************************/ #define PHDRIVER_PIN_RESET_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_IRQ_PULL_CFG PH_DRIVER_PULL_DOWN #define PHDRIVER_PIN_WKUP_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_CLK_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_DWL_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_NSS_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_BUSY_PULL_CFG PH_DRIVER_PULL_UP #ifndef DAL_BOARDS_BOARD_FRDM_MCXN947_PN5190_H_ #define DAL_BOARDS_BOARD_FRDM_MCXN947_PN5190_H_ #define GPIO_PORT 0 #define GPIO_PORT1 1 /****************************************************************** * LPSPI clock configuration ******************************************************************/ /*Clock Frequency for SPI Flexcomm 1*/ #define SPI_CLOCK_FREQ (CLOCK_GetLPFlexCommClkFreq(1u)) #define SPI_MASTER_CLOCK_FREQ SPI_CLOCK_FREQ /****************************************************************** * Board Pin/Gpio configurations ******************************************************************/ #define PHDRIVER_PIN_RESET ((GPIO_PORT << 😎 | 28) /**< Reset pin, Pin28, PIO0_28 */ #define PHDRIVER_PIN_IRQ ((GPIO_PORT << 😎 | 31) /**< IRQ pin, Pin10, PIO0_10 */ /* For 5190 busy is same as IRQ */ #define PHDRIVER_PIN_BUSY ((GPIO_PORT << 😎 | 31) /**< IRQ pin, Pin31, PIO0_31 */ #define PHDRIVER_PIN_DWL ((GPIO_PORT << 😎 | 19) /**< Download pin, Pin19, PIO0_19*/ /* These pins are used for EMVCo Interoperability test status indication, * not for the generic Reader Library implementation. */ #define PHDRIVER_PIN_SUCCESS ((GPIO_PORT1 << 😎 | 0) /**< GPIO, Port 1, Pin0 */ #define PHDRIVER_PIN_FAIL ((GPIO_PORT1 << 😎 | 1) /**< GPIO, Port 1, Pin1 */ /****************************************************************** * PIN Pull-Up/Pull-Down configurations. ******************************************************************/ #define PHDRIVER_PIN_RESET_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_IRQ_PULL_CFG PH_DRIVER_PULL_DOWN #define PHDRIVER_PIN_WKUP_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_CLK_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_DWL_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_NSS_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_BUSY_PULL_CFG PH_DRIVER_PULL_UP We define the macros as well for the interrupt vector of MCXN947, its priority, handler and trigger type. Habib_MS_0-1781198808350.png Spoiler (Highlight to read) /****************************************************************** * IRQ PIN NVIC settings ******************************************************************/ #define EINT_IRQn GPIO00_IRQn /*Adding interrupt vector A of GPIO*/ #define EINT_PRIORITY 7 /*Default interrupt priority for GPIO*/ #define CLIF_IRQHandler GPIO00_IRQHandler /*Interrupt handler for vector A*/ #define PIN_IRQ_TRIGGER_TYPE PH_DRIVER_INTERRUPT_RISINGEDGE /*Rising edge Trigger*/ /****************************************************************** * IRQ PIN NVIC settings ******************************************************************/ #define EINT_IRQn GPIO00_IRQn /*Adding interrupt vector A of GPIO*/ #define EINT_PRIORITY 7 /*Default interrupt priority for GPIO*/ #define CLIF_IRQHandler GPIO00_IRQHandler /*Interrupt handler for vector A*/ #define PIN_IRQ_TRIGGER_TYPE PH_DRIVER_INTERRUPT_RISINGEDGE /*Rising edge Trigger*/ As well as some macros for pin logic levels. Habib_MS_1-1781198875355.png Spoiler (Highlight to read) /***************************************************************** * Front End Reset logic level settings ****************************************************************/ #define PH_DRIVER_SET_HIGH 1 /**< Logic High. */ #define PH_DRIVER_SET_LOW 0 /**< Logic Low. */ #define RESET_POWERDOWN_LEVEL PH_DRIVER_SET_LOW #define RESET_POWERUP_LEVEL PH_DRIVER_SET_HIGH /***************************************************************** * Front End Reset logic level settings ****************************************************************/ #define PH_DRIVER_SET_HIGH 1 /**< Logic High. */ #define PH_DRIVER_SET_LOW 0 /**< Logic Low. */ #define RESET_POWERDOWN_LEVEL PH_DRIVER_SET_LOW #define RESET_POWERUP_LEVEL PH_DRIVER_SET_HIGH Finally, we define macros for the base address of CTIMER and SPI peripherals, clock frequencies, interrupt vectors and related pins. Habib_MS_2-1781198913604.png Spoiler (Highlight to read) /***************************************************************** * SPI Configuration ****************************************************************/ #define PHDRIVER_MCXN947_SPI_MASTER LPSPI1 #define PHDRIVER_MCXN947_SPI_DATA_RATE 5000000U #define PHDRIVER_MCXN947_SPI_CLK_SRC SPI_MASTER_CLOCK_FREQ #define PHDRIVER_MCXN947_SPI_IRQ LP_FLEXCOMM1_IRQn #define SPI_IRQ_PRIORITY 6 /*SPI interrupt priority*/ #define PHDRIVER_PIN_SSEL 27U/* Chip Select, Pin6, SPI */ #define PHDRIVER_PIN_SCK 25U/* SPI clock, Pin7, SPI */ #define PHDRIVER_PIN_MISO 26U/* MISO, Pin8, SPI */ #define PHDRIVER_PIN_MOSI 24U/* MOSI, Pin9, SPI */ #define PHDRIVER_FC1_SPI_DIV kCLOCK_DivFlexcom1Clk #define PHDRIVER_FC1_SPI_CLK kFRO12M_to_FLEXCOMM1 /*Clock to attach to Flexcomm1*/ /***************************************************************** * Timer Configuration ****************************************************************/ #define PH_DRIVER_SDK_CTIMER CTIMER0 /*CTIMER0 base*/ #define PH_DRIVER_SDK_CTIMER_CLK kCLOCK_DivCtimer0Clk/*CTIMER0 clock*/ #define PH_DRIVER_SDK_CTIMER_NVIC CTIMER0_IRQn /*Interrupt vector*/ #define PH_DRIVER_SDK_CTIMER_PRIORITY 4 #define PH_DRIVER_SDK_CTIMER_CLK_FREQ CLOCK_GetCTimerClkFreq(0U) /*CTIMER0 Clock frequency*/ #endif /* DAL_BOARDS_BOARD_FRDM_MCXN947_PN5190_H_ */ /***************************************************************** * SPI Configuration ****************************************************************/ #define PHDRIVER_MCXN947_SPI_MASTER LPSPI1 #define PHDRIVER_MCXN947_SPI_DATA_RATE 5000000U #define PHDRIVER_MCXN947_SPI_CLK_SRC SPI_MASTER_CLOCK_FREQ #define PHDRIVER_MCXN947_SPI_IRQ LP_FLEXCOMM1_IRQn #define SPI_IRQ_PRIORITY 6 /*SPI interrupt priority*/ #define PHDRIVER_PIN_SSEL 27U/* Chip Select, Pin6, SPI */ #define PHDRIVER_PIN_SCK 25U/* SPI clock, Pin7, SPI */ #define PHDRIVER_PIN_MISO 26U/* MISO, Pin8, SPI */ #define PHDRIVER_PIN_MOSI 24U/* MOSI, Pin9, SPI */ #define PHDRIVER_FC1_SPI_DIV kCLOCK_DivFlexcom1Clk #define PHDRIVER_FC1_SPI_CLK kFRO12M_to_FLEXCOMM1 /*Clock to attach to Flexcomm1*/ /***************************************************************** * Timer Configuration ****************************************************************/ #define PH_DRIVER_SDK_CTIMER CTIMER0 /*CTIMER0 base*/ #define PH_DRIVER_SDK_CTIMER_CLK kCLOCK_DivCtimer0Clk/*CTIMER0 clock*/ #define PH_DRIVER_SDK_CTIMER_NVIC CTIMER0_IRQn /*Interrupt vector*/ #define PH_DRIVER_SDK_CTIMER_PRIORITY 4 #define PH_DRIVER_SDK_CTIMER_CLK_FREQ CLOCK_GetCTimerClkFreq(0U) /*CTIMER0 Clock frequency*/ #endif /* DAL_BOARDS_BOARD_FRDM_MCXN947_PN5190_H_ */ MCXN947 SPI and SDK files Now, inside DAL > src folder we will create a folder named “MCXN947” that will contain 2 source files: phbalReg_Mcxn947Spi.c phDriver_Mcxn947SDK.c Habib_MS_3-1781198965225.png Inside these source files we will modify the functions from the source files of other board hosts with the specific configurations of MCXN947 peripheral drivers, such as SPI, timers, GPIOs and interrupt handlers. This is done based on SDK examples such as “ctimer_match_interrupt_example_cm33_core0” and “lpspi_polling_b2b_transfer_master_cm33_core0”. phbalReg_Mcxn947Spi.c: In this file we first need to include the necessary files and include the headers and callbacks to ensure the correct functionality: Habib_MS_4-1781199007051.png Spoiler (Highlight to read) #include "phDriver.h" #include #include "BoardSelection.h" #include #include #include #define PHBAL_REG_MCXN947_SPI_ID 0x0FU /**< ID for MCXN947 SPI BAL component */ #define RX_BUFFER_SIZE_MAX 272U /* Receive Buffer size while exchange */ #ifndef PHDRIVER_MCXN947_SPI_POLLING lpspi_master_handle_t g_masterHandle; /* LPSPI user callback */ void LPSPI_MasterUserCallback(LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData); #endif static void phbalReg_Mcxn947SpiConfig(void); #ifndef PHDRIVER_MCXN947_SPI_POLLING volatile bool isTransferCompleted = false; void LPSPI_MasterUserCallback(LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData) { if (status == kStatus_Success) { __NOP(); } isTransferCompleted = true; } #endif #include "phDriver.h" #include #include "BoardSelection.h" #include #include #include #define PHBAL_REG_MCXN947_SPI_ID 0x0FU /**< ID for MCXN947 SPI BAL component */ #define RX_BUFFER_SIZE_MAX 272U /* Receive Buffer size while exchange */ #ifndef PHDRIVER_MCXN947_SPI_POLLING lpspi_master_handle_t g_masterHandle; /* LPSPI user callback */ void LPSPI_MasterUserCallback(LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData); #endif static void phbalReg_Mcxn947SpiConfig(void); #ifndef PHDRIVER_MCXN947_SPI_POLLING volatile bool isTransferCompleted = false; void LPSPI_MasterUserCallback(LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData) { if (status == kStatus_Success) { __NOP(); } isTransferCompleted = true; } #endif After, we will define the phbalReg_Init function, which will be used by the library to initialize the SPI peripheral in this case, and it is defined as follows: Habib_MS_5-1781199067774.png Spoiler (Highlight to read) phStatus_t phbalReg_Init( void * pDataParams, uint16_t wSizeOfDataParams) { lpspi_master_config_t userConfig; uint32_t srcFreq = 0; if((pDataParams == NULL) || (sizeof(phbalReg_Type_t) != wSizeOfDataParams)) { return (PH_DRIVER_ERROR | PH_COMP_DRIVER); } ((phbalReg_Type_t *)pDataParams)->wId = PH_COMP_DRIVER | PHBAL_REG_MCXN947_SPI_ID; ((phbalReg_Type_t *)pDataParams)->bBalType = PHBAL_REG_TYPE_SPI; /*Initialize Flexcomm1 clock*/ /* attach FRO 12M to FLEXCOMM1 */ CLOCK_SetClkDiv(PHDRIVER_FC1_SPI_DIV, 1u); CLOCK_AttachClk(PHDRIVER_FC1_SPI_CLK); /*Configure SPI pins*/ phbalReg_Mcxn947SpiConfig(); /*SPI configuration*/ LPSPI_MasterGetDefaultConfig(&userConfig); userConfig.baudRate = PHDRIVER_MCXN947_SPI_DATA_RATE; srcFreq = SPI_MASTER_CLOCK_FREQ; userConfig.whichPcs = (lpspi_which_pcs_t)kLPSPI_Pcs0; userConfig.pcsActiveHighOrLow = (lpspi_pcs_polarity_config_t)kLPSPI_PcsActiveLow; userConfig.pcsToSckDelayInNanoSec = 1000000000U / (userConfig.baudRate * 1U); userConfig.lastSckToPcsDelayInNanoSec = 1000000000U / (userConfig.baudRate * 1U); userConfig.betweenTransferDelayInNanoSec = 1000000000U / (userConfig.baudRate * 1U); /*Initialize SPI*/ #ifdef PHDRIVER_MCXN947_SPI_POLLING LPSPI_MasterInit(PHDRIVER_MCXN947_SPI_MASTER, &userConfig, srcFreq); #else LPSPI_MasterInit(PHDRIVER_MCXN947_SPI_MASTER, &userConfig, srcFreq); LPSPI_MasterTransferCreateHandle(PHDRIVER_MCXN947_SPI_MASTER, &g_masterHandle, LPSPI_MasterUserCallback, NULL); #endif return PH_DRIVER_SUCCESS; } phStatus_t phbalReg_Init( void * pDataParams, uint16_t wSizeOfDataParams) { lpspi_master_config_t userConfig; uint32_t srcFreq = 0; if((pDataParams == NULL) || (sizeof(phbalReg_Type_t) != wSizeOfDataParams)) { return (PH_DRIVER_ERROR | PH_COMP_DRIVER); } ((phbalReg_Type_t *)pDataParams)->wId = PH_COMP_DRIVER | PHBAL_REG_MCXN947_SPI_ID; ((phbalReg_Type_t *)pDataParams)->bBalType = PHBAL_REG_TYPE_SPI; /*Initialize Flexcomm1 clock*/ /* attach FRO 12M to FLEXCOMM1 */ CLOCK_SetClkDiv(PHDRIVER_FC1_SPI_DIV, 1u); CLOCK_AttachClk(PHDRIVER_FC1_SPI_CLK); /*Configure SPI pins*/ phbalReg_Mcxn947SpiConfig(); /*SPI configuration*/ LPSPI_MasterGetDefaultConfig(&userConfig); userConfig.baudRate = PHDRIVER_MCXN947_SPI_DATA_RATE; srcFreq = SPI_MASTER_CLOCK_FREQ; userConfig.whichPcs = (lpspi_which_pcs_t)kLPSPI_Pcs0; userConfig.pcsActiveHighOrLow = (lpspi_pcs_polarity_config_t)kLPSPI_PcsActiveLow; userConfig.pcsToSckDelayInNanoSec = 1000000000U / (userConfig.baudRate * 1U); userConfig.lastSckToPcsDelayInNanoSec = 1000000000U / (userConfig.baudRate * 1U); userConfig.betweenTransferDelayInNanoSec = 1000000000U / (userConfig.baudRate * 1U); /*Initialize SPI*/ #ifdef PHDRIVER_MCXN947_SPI_POLLING LPSPI_MasterInit(PHDRIVER_MCXN947_SPI_MASTER, &userConfig, srcFreq); #else LPSPI_MasterInit(PHDRIVER_MCXN947_SPI_MASTER, &userConfig, srcFreq); LPSPI_MasterTransferCreateHandle(PHDRIVER_MCXN947_SPI_MASTER, &g_masterHandle, LPSPI_MasterUserCallback, NULL); #endif return PH_DRIVER_SUCCESS; } We have to define the phbalReg_Exchange function as well, which is used for communicating via SPI with the PN5190. Habib_MS_0-1781200864120.png Habib_MS_1-1781200889109.png Spoiler (Highlight to read) phStatus_t phbalReg_Exchange( void * pDataParams, uint16_t wOption, uint8_t * pTxBuffer, uint16_t wTxLength, uint16_t wRxBufSize, uint8_t * pRxBuffer, uint16_t * pRxLength ) { phStatus_t status = PH_DRIVER_SUCCESS; uint8_t * pRxBuf; status_t lpspiStatus; lpspi_transfer_t g_masterXfer; uint8_t g_dummyBuffer[RX_BUFFER_SIZE_MAX]; if(pRxBuffer == NULL) { pRxBuf = g_dummyBuffer; } else { pRxBuf = pRxBuffer; } if(pTxBuffer == NULL) { wTxLength = wRxBufSize; g_dummyBuffer[0] = 0xFF; pTxBuffer = g_dummyBuffer; } memset(&g_masterXfer, 0, sizeof(lpspi_transfer_t)); /* Set up the transfer */ g_masterXfer.txData = pTxBuffer; g_masterXfer.rxData = pRxBuf; g_masterXfer.dataSize = wTxLength; g_masterXfer.configFlags = kLPSPI_MasterPcs0 | kLPSPI_MasterPcsContinuous | kLPSPI_MasterByteSwap; /* Start transfer */ #ifdef PHDRIVER_MCXN947_SPI_POLLING lpspiStatus = LPSPI_MasterTransferBlocking(PHDRIVER_MCXN947_SPI_MASTER, &g_masterXfer); #else lpspiStatus = LPSPI_MasterTransferNonBlocking(PHDRIVER_MCXN947_SPI_MASTER, &g_masterHandle, &g_masterXfer); /* Wait transfer complete */ while (!isTransferCompleted) { } #endif if (lpspiStatus != kStatus_Success) { return (PH_DRIVER_FAILURE | PH_COMP_DRIVER); } if (pRxLength != NULL) { *pRxLength = wTxLength; } #ifndef PHDRIVER_MCXN947_SPI_POLLING SDK_DelayAtLeastUs(300U, BOARD_BOOTCLOCKPLL150M_CORE_CLOCK); #endif return status; } phStatus_t phbalReg_Exchange( void * pDataParams, uint16_t wOption, uint8_t * pTxBuffer, uint16_t wTxLength, uint16_t wRxBufSize, uint8_t * pRxBuffer, uint16_t * pRxLength ) { phStatus_t status = PH_DRIVER_SUCCESS; uint8_t * pRxBuf; status_t lpspiStatus; lpspi_transfer_t g_masterXfer; uint8_t g_dummyBuffer[RX_BUFFER_SIZE_MAX]; if(pRxBuffer == NULL) { pRxBuf = g_dummyBuffer; } else { pRxBuf = pRxBuffer; } if(pTxBuffer == NULL) { wTxLength = wRxBufSize; g_dummyBuffer[0] = 0xFF; pTxBuffer = g_dummyBuffer; } memset(&g_masterXfer, 0, sizeof(lpspi_transfer_t)); /* Set up the transfer */ g_masterXfer.txData = pTxBuffer; g_masterXfer.rxData = pRxBuf; g_masterXfer.dataSize = wTxLength; g_masterXfer.configFlags = kLPSPI_MasterPcs0 | kLPSPI_MasterPcsContinuous | kLPSPI_MasterByteSwap; /* Start transfer */ #ifdef PHDRIVER_MCXN947_SPI_POLLING lpspiStatus = LPSPI_MasterTransferBlocking(PHDRIVER_MCXN947_SPI_MASTER, &g_masterXfer); #else lpspiStatus = LPSPI_MasterTransferNonBlocking(PHDRIVER_MCXN947_SPI_MASTER, &g_masterHandle, &g_masterXfer); /* Wait transfer complete */ while (!isTransferCompleted) { } #endif if (lpspiStatus != kStatus_Success) { return (PH_DRIVER_FAILURE | PH_COMP_DRIVER); } if (pRxLength != NULL) { *pRxLength = wTxLength; } #ifndef PHDRIVER_MCXN947_SPI_POLLING SDK_DelayAtLeastUs(300U, BOARD_BOOTCLOCKPLL150M_CORE_CLOCK); #endif return status; } Finally, we will define the phbalReg_Mcxn947SpiConfig function, which is called by phbalReg_Init to configure the SPI pins on the MCXN947: Habib_MS_2-1781200981954.png Spoiler (Highlight to read) static void phbalReg_Mcxn947SpiConfig(void) { const port_pin_config_t port0_24_pinB6_config = { kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P0 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_24 (pin B6) is configured as SPI_MOSI */ PORT_SetPinConfig(PORT0, 24U, &port0_24_pinB6_config); const port_pin_config_t port0_25_pinA6_config = {kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P1 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_25 (pin A6) is configured as SPI_SCK */ PORT_SetPinConfig(PORT0, 25U, &port0_25_pinA6_config); const port_pin_config_t port0_26_pinF10_config = {kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P2 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_26 (pin F10) is configured as SPI_MISO */ PORT_SetPinConfig(PORT0, 26U, &port0_26_pinF10_config); const port_pin_config_t port0_27_pinE10_config = {kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P3 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_27 (pin E10) is configured as SPI_CS */ PORT_SetPinConfig(PORT0, 27U, &port0_27_pinE10_config); } static void phbalReg_Mcxn947SpiConfig(void) { const port_pin_config_t port0_24_pinB6_config = { kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P0 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_24 (pin B6) is configured as SPI_MOSI */ PORT_SetPinConfig(PORT0, 24U, &port0_24_pinB6_config); const port_pin_config_t port0_25_pinA6_config = {kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P1 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_25 (pin A6) is configured as SPI_SCK */ PORT_SetPinConfig(PORT0, 25U, &port0_25_pinA6_config); const port_pin_config_t port0_26_pinF10_config = {kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P2 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_26 (pin F10) is configured as SPI_MISO */ PORT_SetPinConfig(PORT0, 26U, &port0_26_pinF10_config); const port_pin_config_t port0_27_pinE10_config = {kPORT_PullUp, kPORT_LowPullResistor, kPORT_SlowSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as FC1_P3 */ kPORT_MuxAlt2, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_27 (pin E10) is configured as SPI_CS */ PORT_SetPinConfig(PORT0, 27U, &port0_27_pinE10_config); } phDriver_Mcxn947SDK.c: In this file we will have the following definitions and includes that describe relevant characteristics of the ctimer (configuration structures, interrupt handlers and maximum count value), and of the GPIO port: Habib_MS_3-1781201256179.png Spoiler (Highlight to read) #include "phDriver.h" #include "BoardSelection.h" #include "fsl_device_registers.h" #include #include /* *********************************************************************************************************** * Internal Definitions * ********************************************************************************************************** */ #define MCXN947_TIMER_MAX_32BIT 0xFFFFFFFFU #define CTIMER_HANDLER CTIMER0_IRQHandler /* *********************************************************************************************************** * * Type Definitions *********************************************************************************************************** */ volatile bool ctimerIsrFlag = false; /* *********************************************************************************************************** * Global and Static Variables * * Match Configuration for CTIMER Channel 0*/ static ctimer_match_config_t matchConfig0; /* Total Size: NNNbytes * ********************************************************************************************************** */ /* Array initializer of GPIO peripheral base pointers */ static const GPIO_Type *pGpiosBaseAddr[] = GPIO_BASE_PTRS; static pphDriver_TimerCallBck_t pCTimerCallBack; static volatile uint8_t dwTimerExp; static const gpio_interrupt_config_t aInterruptTypes[] = {kGPIO_InterruptLogicZero, /* Unused. */ kGPIO_InterruptLogicZero, kGPIO_InterruptLogicOne, kGPIO_InterruptRisingEdge, kGPIO_InterruptFallingEdge, kGPIO_InterruptEitherEdge, }; /* *********************************************************************************************************** * Private Functions Prototypes * ********************************************************************************************************** */ static void phDriver_CTimerIsrCallBack(void); #include "phDriver.h" #include "BoardSelection.h" #include "fsl_device_registers.h" #include #include /* *********************************************************************************************************** * Internal Definitions * ********************************************************************************************************** */ #define MCXN947_TIMER_MAX_32BIT 0xFFFFFFFFU #define CTIMER_HANDLER CTIMER0_IRQHandler /* *********************************************************************************************************** * * Type Definitions *********************************************************************************************************** */ volatile bool ctimerIsrFlag = false; /* *********************************************************************************************************** * Global and Static Variables * * Match Configuration for CTIMER Channel 0*/ static ctimer_match_config_t matchConfig0; /* Total Size: NNNbytes * ********************************************************************************************************** */ /* Array initializer of GPIO peripheral base pointers */ static const GPIO_Type *pGpiosBaseAddr[] = GPIO_BASE_PTRS; static pphDriver_TimerCallBck_t pCTimerCallBack; static volatile uint8_t dwTimerExp; static const gpio_interrupt_config_t aInterruptTypes[] = {kGPIO_InterruptLogicZero, /* Unused. */ kGPIO_InterruptLogicZero, kGPIO_InterruptLogicOne, kGPIO_InterruptRisingEdge, kGPIO_InterruptFallingEdge, kGPIO_InterruptEitherEdge, }; /* *********************************************************************************************************** * Private Functions Prototypes * ********************************************************************************************************** */ static void phDriver_CTimerIsrCallBack(void); We will define the following functions to initialize and stop the timer, and to enable timer interruptions and its callback: Habib_MS_4-1781201344846.png Habib_MS_5-1781201376952.png Spoiler (Highlight to read) phStatus_t phDriver_TimerStart(phDriver_Timer_Unit_t eTimerUnit, uint32_t dwTimePeriod, pphDriver_TimerCallBck_t pTimerCallBack) { uint64_t qwTimerCnt; uint32_t dwTimerFreq; dwTimerFreq = PH_DRIVER_SDK_CTIMER_CLK_FREQ; qwTimerCnt = dwTimerFreq; qwTimerCnt = (qwTimerCnt / eTimerUnit); qwTimerCnt = (dwTimePeriod * qwTimerCnt); /* 32-bit timers. */ if(qwTimerCnt > (uint64_t)MCXN947_TIMER_MAX_32BIT) { return PH_DRIVER_ERROR | PH_COMP_DRIVER; } if(pTimerCallBack == NULL) /* Timer Start is blocking call. */ { dwTimerExp = 0; pCTimerCallBack = phDriver_CTimerIsrCallBack; } else /* Call the Timer callback. */ { pCTimerCallBack = pTimerCallBack; } /*Configure & start CTIMER*/ /*Ctimer config structure*/ ctimer_config_t config; /*Timer mode, init*/ CTIMER_GetDefaultConfig(&config); CTIMER_Init(PH_DRIVER_SDK_CTIMER, &config); CTIMER_EnableInterrupts(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0InterruptEnable|kCTIMER_Capture0InterruptEnable); /* Configuration match 0 */ matchConfig0.enableCounterReset = true; matchConfig0.enableCounterStop = false; matchConfig0.matchValue = (uint32_t)qwTimerCnt; matchConfig0.outControl = kCTIMER_Output_NoAction; matchConfig0.outPinInitState = false; matchConfig0.enableInterrupt = true; EnableIRQ(PH_DRIVER_SDK_CTIMER_NVIC); NVIC_SetPriority(PH_DRIVER_SDK_CTIMER_NVIC, PH_DRIVER_SDK_CTIMER_PRIORITY); /*Setup Match*/ CTIMER_SetupMatch(PH_DRIVER_SDK_CTIMER, kCTIMER_Match_0, &matchConfig0); /*Start*/ CTIMER_StartTimer(PH_DRIVER_SDK_CTIMER); while (true) { /* Check whether an interrupt occurred */ if (true == ctimerIsrFlag && dwTimerExp) { /* Clear interrupt flag*/ ctimerIsrFlag = false; break; } } return PH_DRIVER_SUCCESS; } phStatus_t phDriver_TimerStart(phDriver_Timer_Unit_t eTimerUnit, uint32_t dwTimePeriod, pphDriver_TimerCallBck_t pTimerCallBack) { uint64_t qwTimerCnt; uint32_t dwTimerFreq; dwTimerFreq = PH_DRIVER_SDK_CTIMER_CLK_FREQ; qwTimerCnt = dwTimerFreq; qwTimerCnt = (qwTimerCnt / eTimerUnit); qwTimerCnt = (dwTimePeriod * qwTimerCnt); /* 32-bit timers. */ if(qwTimerCnt > (uint64_t)MCXN947_TIMER_MAX_32BIT) { return PH_DRIVER_ERROR | PH_COMP_DRIVER; } if(pTimerCallBack == NULL) /* Timer Start is blocking call. */ { dwTimerExp = 0; pCTimerCallBack = phDriver_CTimerIsrCallBack; } else /* Call the Timer callback. */ { pCTimerCallBack = pTimerCallBack; } /*Configure & start CTIMER*/ /*Ctimer config structure*/ ctimer_config_t config; /*Timer mode, init*/ CTIMER_GetDefaultConfig(&config); CTIMER_Init(PH_DRIVER_SDK_CTIMER, &config); CTIMER_EnableInterrupts(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0InterruptEnable|kCTIMER_Capture0InterruptEnable); /* Configuration match 0 */ matchConfig0.enableCounterReset = true; matchConfig0.enableCounterStop = false; matchConfig0.matchValue = (uint32_t)qwTimerCnt; matchConfig0.outControl = kCTIMER_Output_NoAction; matchConfig0.outPinInitState = false; matchConfig0.enableInterrupt = true; EnableIRQ(PH_DRIVER_SDK_CTIMER_NVIC); NVIC_SetPriority(PH_DRIVER_SDK_CTIMER_NVIC, PH_DRIVER_SDK_CTIMER_PRIORITY); /*Setup Match*/ CTIMER_SetupMatch(PH_DRIVER_SDK_CTIMER, kCTIMER_Match_0, &matchConfig0); /*Start*/ CTIMER_StartTimer(PH_DRIVER_SDK_CTIMER); while (true) { /* Check whether an interrupt occurred */ if (true == ctimerIsrFlag && dwTimerExp) { /* Clear interrupt flag*/ ctimerIsrFlag = false; break; } } return PH_DRIVER_SUCCESS; } Habib_MS_7-1781201652469.png Spoiler (Highlight to read) phStatus_t phDriver_TimerStop(void) { /*Stop timer & disable interrupts*/ CTIMER_StopTimer(PH_DRIVER_SDK_CTIMER); CTIMER_DisableInterrupts(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0InterruptEnable|kCTIMER_Capture0InterruptEnable); /* Disable at the NVIC */ DisableIRQ(PH_DRIVER_SDK_CTIMER_NVIC); return PH_DRIVER_SUCCESS; } phStatus_t phDriver_TimerStop(void) { /*Stop timer & disable interrupts*/ CTIMER_StopTimer(PH_DRIVER_SDK_CTIMER); CTIMER_DisableInterrupts(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0InterruptEnable|kCTIMER_Capture0InterruptEnable); /* Disable at the NVIC */ DisableIRQ(PH_DRIVER_SDK_CTIMER_NVIC); return PH_DRIVER_SUCCESS; } We will also have definitions for the functions that configure and handle GPIOs of the MCXN947 and enable interruptions. Habib_MS_0-1781201935240.png Spoiler (Highlight to read) phStatus_t phDriver_PinConfig(uint32_t dwPinNumber, phDriver_Pin_Func_t ePinFunc, phDriver_Pin_Config_t *pPinConfig) { gpio_pin_config_t sGpioConfig; uint8_t bPinNum; uint8_t bPortGpio; if((ePinFunc == PH_DRIVER_PINFUNC_BIDIR) || (pPinConfig == NULL)) { return PH_DRIVER_ERROR | PH_COMP_DRIVER; } /* Extract the Pin, Gpio, Port details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bPortGpio = (uint8_t)((dwPinNumber & 0xFF00)>>8); sGpioConfig.pinDirection = (ePinFunc == PH_DRIVER_PINFUNC_OUTPUT) ? kGPIO_DigitalOutput:kGPIO_DigitalInput; sGpioConfig.outputLogic = pPinConfig->bOutputLogic; if(ePinFunc == PH_DRIVER_PINFUNC_INTERRUPT) { gpio_interrupt_config_t intConfig = aInterruptTypes[(uint8_t)pPinConfig->eInterruptConfig]; GPIO_GpioClearInterruptFlags((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum); GPIO_SetPinInterruptConfig((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum, intConfig); EnableIRQ(EINT_IRQn); GPIO_PinInit((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT],bPinNum,&sGpioConfig); } else { GPIO_PinInit((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT],bPinNum,&sGpioConfig); } return PH_DRIVER_SUCCESS; } phStatus_t phDriver_PinConfig(uint32_t dwPinNumber, phDriver_Pin_Func_t ePinFunc, phDriver_Pin_Config_t *pPinConfig) { gpio_pin_config_t sGpioConfig; uint8_t bPinNum; uint8_t bPortGpio; if((ePinFunc == PH_DRIVER_PINFUNC_BIDIR) || (pPinConfig == NULL)) { return PH_DRIVER_ERROR | PH_COMP_DRIVER; } /* Extract the Pin, Gpio, Port details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bPortGpio = (uint8_t)((dwPinNumber & 0xFF00)>>8); sGpioConfig.pinDirection = (ePinFunc == PH_DRIVER_PINFUNC_OUTPUT) ? kGPIO_DigitalOutput:kGPIO_DigitalInput; sGpioConfig.outputLogic = pPinConfig->bOutputLogic; if(ePinFunc == PH_DRIVER_PINFUNC_INTERRUPT) { gpio_interrupt_config_t intConfig = aInterruptTypes[(uint8_t)pPinConfig->eInterruptConfig]; GPIO_GpioClearInterruptFlags((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum); GPIO_SetPinInterruptConfig((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum, intConfig); EnableIRQ(EINT_IRQn); GPIO_PinInit((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT],bPinNum,&sGpioConfig); } else { GPIO_PinInit((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT],bPinNum,&sGpioConfig); } return PH_DRIVER_SUCCESS; } Habib_MS_1-1781202317214.png Spoiler (Highlight to read) uint8_t phDriver_PinRead(uint32_t dwPinNumber, phDriver_Pin_Func_t ePinFunc) { uint8_t bValue; uint32_t intStatus; uint8_t bGpioNum; uint8_t bPinNum; /* Extract the Pin, Gpio details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bGpioNum = (uint8_t)((dwPinNumber & 0xFF00)>>8); if(ePinFunc == PH_DRIVER_PINFUNC_INTERRUPT) { /*Get value of pin interrupt status*/ intStatus = GPIO_PinGetInterruptFlag((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum); bValue = intStatus ? 1:0; } else { /*Read pin value*/ bValue = (uint8_t)GPIO_PinRead((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum); } return bValue; } uint8_t phDriver_PinRead(uint32_t dwPinNumber, phDriver_Pin_Func_t ePinFunc) { uint8_t bValue; uint32_t intStatus; uint8_t bGpioNum; uint8_t bPinNum; /* Extract the Pin, Gpio details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bGpioNum = (uint8_t)((dwPinNumber & 0xFF00)>>8); if(ePinFunc == PH_DRIVER_PINFUNC_INTERRUPT) { /*Get value of pin interrupt status*/ intStatus = GPIO_PinGetInterruptFlag((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum); bValue = intStatus ? 1:0; } else { /*Read pin value*/ bValue = (uint8_t)GPIO_PinRead((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum); } return bValue; } Habib_MS_3-1781202436423.png Spoiler (Highlight to read) void phDriver_PinWrite(uint32_t dwPinNumber, uint8_t bValue) { uint8_t bGpioNum; uint8_t bPinNum; /* Extract the Pin, Gpio details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bGpioNum = (uint8_t)((dwPinNumber & 0xFF00)>>8); GPIO_PinWrite((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum, bValue); } void phDriver_PinClearIntStatus(uint32_t dwPinNumber) { uint8_t bGpioNum; uint8_t bPinNum; /* Extract the Pin, Gpio details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bGpioNum = (uint8_t)((dwPinNumber & 0xFF00)>>8); /*Clear interrupt flag*/ GPIO_GpioClearInterruptFlags((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], (1U << bPinNum)); } void phDriver_PinWrite(uint32_t dwPinNumber, uint8_t bValue) { uint8_t bGpioNum; uint8_t bPinNum; /* Extract the Pin, Gpio details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bGpioNum = (uint8_t)((dwPinNumber & 0xFF00)>>8); GPIO_PinWrite((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], bPinNum, bValue); } void phDriver_PinClearIntStatus(uint32_t dwPinNumber) { uint8_t bGpioNum; uint8_t bPinNum; /* Extract the Pin, Gpio details from dwPinNumber */ bPinNum = (uint8_t)(dwPinNumber & 0xFF); bGpioNum = (uint8_t)((dwPinNumber & 0xFF00)>>8); /*Clear interrupt flag*/ GPIO_GpioClearInterruptFlags((GPIO_Type *)pGpiosBaseAddr[GPIO_PORT], (1U << bPinNum)); } It is also necessary to add functions required for the library to function correctly. Habib_MS_4-1781202506101.png Spoiler (Highlight to read) void phDriver_EnterCriticalSection(void) { NVIC_DisableIRQ(EINT_IRQn); } void phDriver_ExitCriticalSection(void) { NVIC_EnableIRQ(EINT_IRQn); } phStatus_t phDriver_IRQPinRead(uint32_t dwPinNumber) { phStatus_t bGpioVal = false; bGpioVal = phDriver_PinRead(dwPinNumber, PH_DRIVER_PINFUNC_INPUT); return bGpioVal; } phStatus_t phDriver_IRQPinPoll(uint32_t dwPinNumber, phDriver_Pin_Func_t ePinFunc, phDriver_Interrupt_Config_t eInterruptType) { uint8_t bGpioState = 0; if ((eInterruptType != PH_DRIVER_INTERRUPT_RISINGEDGE) && (eInterruptType != PH_DRIVER_INTERRUPT_FALLINGEDGE)) { return PH_DRIVER_ERROR | PH_COMP_DRIVER; } if (eInterruptType == PH_DRIVER_INTERRUPT_FALLINGEDGE) { bGpioState = 1; } while(phDriver_PinRead(dwPinNumber, ePinFunc) == bGpioState); return PH_DRIVER_SUCCESS; } void phDriver_EnterCriticalSection(void) { NVIC_DisableIRQ(EINT_IRQn); } void phDriver_ExitCriticalSection(void) { NVIC_EnableIRQ(EINT_IRQn); } phStatus_t phDriver_IRQPinRead(uint32_t dwPinNumber) { phStatus_t bGpioVal = false; bGpioVal = phDriver_PinRead(dwPinNumber, PH_DRIVER_PINFUNC_INPUT); return bGpioVal; } phStatus_t phDriver_IRQPinPoll(uint32_t dwPinNumber, phDriver_Pin_Func_t ePinFunc, phDriver_Interrupt_Config_t eInterruptType) { uint8_t bGpioState = 0; if ((eInterruptType != PH_DRIVER_INTERRUPT_RISINGEDGE) && (eInterruptType != PH_DRIVER_INTERRUPT_FALLINGEDGE)) { return PH_DRIVER_ERROR | PH_COMP_DRIVER; } if (eInterruptType == PH_DRIVER_INTERRUPT_FALLINGEDGE) { bGpioState = 1; } while(phDriver_PinRead(dwPinNumber, ePinFunc) == bGpioState); return PH_DRIVER_SUCCESS; } Finally, here, we will have the definition of the timer interrupt handler and ISR callback. Habib_MS_5-1781202601491.png Spoiler (Highlight to read) void CTIMER0_IRQHandler(void) { /* Clear interrupt flag.*/ CTIMER_ClearStatusFlags(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0Flag|kCTIMER_Capture0Flag); /* Single shot timer. Stop it. */ CTIMER_StopTimer(PH_DRIVER_SDK_CTIMER); CTIMER_DisableInterrupts(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0InterruptEnable|kCTIMER_Capture0InterruptEnable); pCTimerCallBack(); ctimerIsrFlag = true; } static void phDriver_CTimerIsrCallBack(void) { dwTimerExp = 1; } void CTIMER0_IRQHandler(void) { /* Clear interrupt flag.*/ CTIMER_ClearStatusFlags(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0Flag|kCTIMER_Capture0Flag); /* Single shot timer. Stop it. */ CTIMER_StopTimer(PH_DRIVER_SDK_CTIMER); CTIMER_DisableInterrupts(PH_DRIVER_SDK_CTIMER, kCTIMER_Match0InterruptEnable|kCTIMER_Capture0InterruptEnable); pCTimerCallBack(); ctimerIsrFlag = true; } static void phDriver_CTimerIsrCallBack(void) { dwTimerExp = 1; } With these additions, we have all the functions needed (based on the FRDM-MCXN947 SDK) by the library to communicate with the PN5190. BoardSelection.h In this header file, which is found at “DAL > cfg” we will add the definition set in the preprocessor settings to use the FRDM-MCXN947 board as host by adding the following lines to the file: Habib_MS_6-1781202691439.png Spoiler (Highlight to read) #ifdef PHDRIVER_FRDMMCXN947_PN5190_BOARD # include #endif #ifdef PHDRIVER_FRDMMCXN947_PN5190_BOARD # include #endif ph_NxpBuild_App.h In this header found at “intfs” folder, we will add our board support to use it with the PN5190 by adding the following change: Habib_MS_7-1781202815632.png Spoiler (Highlight to read) #if defined(PHDRIVER_LPC1769PN5190_BOARD) \ || defined(PHDRIVER_K82F_PNEV5190B_BOARD)\ || defined(PHDRIVER_FRDMMCXN947_PN5190_BOARD) # define NXPBUILD__PHHAL_HW_PN5190 #endif #if defined(PHDRIVER_LPC1769PN5190_BOARD) \ || defined(PHDRIVER_K82F_PNEV5190B_BOARD)\ || defined(PHDRIVER_FRDMMCXN947_PN5190_BOARD) # define NXPBUILD__PHHAL_HW_PN5190 #endif phApp_Init.h In this header located at “intfs” folder we will add the required include files for the initialization of our board and enable the correct debug interface. Habib_MS_8-1781202847396.png Spoiler (Highlight to read) /*Check for MCXN controller based boards*/ #if defined (PHDRIVER_FRDMMCXN947_PN5190_BOARD) #define PHDRIVER_FRDM_MCXN947 #endif #ifdef PHDRIVER_FRDM_MCXN947 #include #include #include #include #include #include #endif Please replace this line. /*Check for MCXN controller based boards*/ #if defined (PHDRIVER_FRDMMCXN947_PN5190_BOARD) #define PHDRIVER_FRDM_MCXN947 #endif #ifdef PHDRIVER_FRDM_MCXN947 #include #include #include #include #include #include #endif Please replace this line. Spoiler (Highlight to read) #if defined(PHDRIVER_KINETIS_K82)|| defined(PHDRIVER_FRDM_MCXN947)   #if defined(PHDRIVER_KINETIS_K82)|| defined(PHDRIVER_FRDM_MCXN947) phApp_Init.c Finally, in this source file we will add the initialization code for the MCXN947 to complement the initialization macros defined in the previous phApp_Init.h file modification. Here we will call functions to initialize clocks and UART pins. Habib_MS_0-1781205399694.png Spoiler (Highlight to read) #ifdef PHDRIVER_FRDM_MCXN947 #include "fsl_common.h" #include "pin_mux.h" #include "clock_config.h" #include "board.h" static void phApp_MCXN947_Init(void){ BOARD_InitBootPins(); BOARD_InitBootClocks(); BOARD_InitDebugConsole(); } #endif #ifdef PHDRIVER_FRDM_MCXN947 #include "fsl_common.h" #include "pin_mux.h" #include "clock_config.h" #include "board.h" static void phApp_MCXN947_Init(void){ BOARD_InitBootPins(); BOARD_InitBootClocks(); BOARD_InitDebugConsole(); } #endif Spoiler (Highlight to read) #elif defined(PHDRIVER_FRDM_MCXN947) phApp_MCXN947_Init(); #elif defined(PHDRIVER_FRDM_MCXN947) phApp_MCXN947_Init(); These functions are used to initialize the correspondent clocks of each peripheral such as CTIMER, the input pins multiplexor for selecting GPIO functionality and FLEXCOMM for SPI. In here we also set the GPIO functionality for pins P0_31 and P0_28 (IRQ and RESET), as well as UART3 for printing the tag information on the serial port connected to the computer. Additionally, we need to set the NVIC priority to ensure that interrupts can occur. Add the NVIC_SetPriority() function to phApp_Configure_IRQ(). Habib_MS_1-1781205512787.png Spoiler (Highlight to read) #ifdef PH_PLATFORM_HAS_ICFRONTEND #if !(defined(PH_OSAL_LINUX) && defined(NXPBUILD__PHHAL_HW_PN5190)) phDriver_Pin_Config_t pinCfg; NVIC_SetPriority(EINT_IRQn, EINT_PRIORITY); pinCfg.bOutputLogic = PH_DRIVER_SET_LOW; pinCfg.bPullSelect = PHDRIVER_PIN_IRQ_PULL_CFG; pinCfg.eInterruptConfig = PIN_IRQ_TRIGGER_TYPE; phDriver_PinConfig(PHDRIVER_PIN_IRQ, PH_DRIVER_PINFUNC_INTERRUPT, &pinCfg); #endif #ifdef PH_PLATFORM_HAS_ICFRONTEND #if !(defined(PH_OSAL_LINUX) && defined(NXPBUILD__PHHAL_HW_PN5190)) phDriver_Pin_Config_t pinCfg; NVIC_SetPriority(EINT_IRQn, EINT_PRIORITY); pinCfg.bOutputLogic = PH_DRIVER_SET_LOW; pinCfg.bPullSelect = PHDRIVER_PIN_IRQ_PULL_CFG; pinCfg.eInterruptConfig = PIN_IRQ_TRIGGER_TYPE; phDriver_PinConfig(PHDRIVER_PIN_IRQ, PH_DRIVER_PINFUNC_INTERRUPT, &pinCfg); #endif pin_mux.c Inside the function “BOARD_InitBootPins()” which is defined in board -> pin_mux.c file, the following initializations need to be added: Habib_MS_3-1781205793803.png Spoiler (Highlight to read) void BOARD_InitBootPins(void) { /* Use FRO HF clock for some of the Ctimers */ CLOCK_SetClkDiv(kCLOCK_DivCtimer0Clk, 1u); CLOCK_AttachClk(kFRO_HF_to_CTIMER0); CLOCK_EnableClock(kCLOCK_Gpio0); CLOCK_EnableClock(kCLOCK_Gpio1); BOARD_InitPins(); } void BOARD_InitBootPins(void) { /* Use FRO HF clock for some of the Ctimers */ CLOCK_SetClkDiv(kCLOCK_DivCtimer0Clk, 1u); CLOCK_AttachClk(kFRO_HF_to_CTIMER0); CLOCK_EnableClock(kCLOCK_Gpio0); CLOCK_EnableClock(kCLOCK_Gpio1); BOARD_InitPins(); } Additionally, within the “BOARD_InitPins()” function available in the same file, we will replace the initializations of the GPIO and UART pins. Habib_MS_4-1781205847058.png Habib_MS_5-1781205872354.png Habib_MS_6-1781205919494.png Spoiler (Highlight to read) void BOARD_InitPins(void) { /* Enables the clock for PORT0 controller: Enables clock */ CLOCK_EnableClock(kCLOCK_Port0); /* Enables the clock for PORT1: Enables clock */ CLOCK_EnableClock(kCLOCK_Port1); const port_pin_config_t port0_19_config = {/* Internal pull-up/down resistor is disabled */ kPORT_PullDisable, /* Low internal pull resistor value is selected. */ kPORT_LowPullResistor, /* Fast slew rate is configured */ kPORT_FastSlewRate, /* Passive input filter is disabled */ kPORT_PassiveFilterDisable, /* Open drain output is disabled */ kPORT_OpenDrainDisable, /* Low drive strength is configured */ kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, /* Digital input enabled */ kPORT_InputBufferEnable, /* Digital input is not inverted */ kPORT_InputNormal, /* Pin Control Register fields [15:0] are not locked */ kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT0, 19U, &port0_19_config); const port_pin_config_t port1_0_config = { kPORT_PullDisable, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT1, 0U, &port1_0_config); const port_pin_config_t port1_1_config = { kPORT_PullDisable, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT1, 1U, &port1_1_config); const port_pin_config_t port0_31_pinB12_config = { kPORT_PullDown, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT0, 31U, &port0_31_pinB12_config); const port_pin_config_t port0_28_config = { kPORT_PullDisable, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_6 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_6 (pin C14) is configured as PIO0_6 */ PORT_SetPinConfig(PORT0, 28U, &port0_28_config); const port_pin_config_t port0_2_pinB16_config = { .pullSelect = kPORT_PullDisable, .pullValueSelect = kPORT_LowPullResistor, .slewRate = kPORT_FastSlewRate, .passiveFilterEnable = kPORT_PassiveFilterDisable, .openDrainEnable = kPORT_OpenDrainDisable, .driveStrength = kPORT_HighDriveStrength, /* Pin is configured as SWO */ .mux = kPORT_MuxAlt1, .inputBuffer = kPORT_InputBufferEnable, .invertInput = kPORT_InputNormal, .lockRegister = kPORT_UnlockRegister}; /* PORT0_2 (pin B16) is configured as SWO */ PORT_SetPinConfig(PORT0, 2U, &port0_2_pinB16_config); const port_pin_config_t port1_8_pinA1_config = { .pullSelect = kPORT_PullUp, .pullValueSelect = kPORT_LowPullResistor, .slewRate = kPORT_FastSlewRate, .passiveFilterEnable = kPORT_PassiveFilterDisable, .openDrainEnable = kPORT_OpenDrainDisable, .driveStrength = kPORT_LowDriveStrength, /* Pin is configured as FC4_P0 */ .mux = kPORT_MuxAlt2, .inputBuffer = kPORT_InputBufferEnable, .invertInput = kPORT_InputNormal, .lockRegister = kPORT_UnlockRegister}; /* PORT1_8 (pin A1) is configured as FC4_P0 */ PORT_SetPinConfig(PORT1, 8U, &port1_8_pinA1_config); const port_pin_config_t port1_9_pinB1_config = { .pullSelect = kPORT_PullDisable, .pullValueSelect = kPORT_LowPullResistor, .slewRate = kPORT_FastSlewRate, .passiveFilterEnable = kPORT_PassiveFilterDisable, .openDrainEnable = kPORT_OpenDrainDisable, .driveStrength = kPORT_LowDriveStrength, /* Pin is configured as FC4_P1 */ .mux = kPORT_MuxAlt2, .inputBuffer = kPORT_InputBufferEnable, .invertInput = kPORT_InputNormal, .lockRegister = kPORT_UnlockRegister}; /* PORT1_9 (pin B1) is configured as FC4_P1 */ PORT_SetPinConfig(PORT1, 9U, &port1_9_pinB1_config); } void BOARD_InitPins(void) { /* Enables the clock for PORT0 controller: Enables clock */ CLOCK_EnableClock(kCLOCK_Port0); /* Enables the clock for PORT1: Enables clock */ CLOCK_EnableClock(kCLOCK_Port1); const port_pin_config_t port0_19_config = {/* Internal pull-up/down resistor is disabled */ kPORT_PullDisable, /* Low internal pull resistor value is selected. */ kPORT_LowPullResistor, /* Fast slew rate is configured */ kPORT_FastSlewRate, /* Passive input filter is disabled */ kPORT_PassiveFilterDisable, /* Open drain output is disabled */ kPORT_OpenDrainDisable, /* Low drive strength is configured */ kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, /* Digital input enabled */ kPORT_InputBufferEnable, /* Digital input is not inverted */ kPORT_InputNormal, /* Pin Control Register fields [15:0] are not locked */ kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT0, 19U, &port0_19_config); const port_pin_config_t port1_0_config = { kPORT_PullDisable, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT1, 0U, &port1_0_config); const port_pin_config_t port1_1_config = { kPORT_PullDisable, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT1, 1U, &port1_1_config); const port_pin_config_t port0_31_pinB12_config = { kPORT_PullDown, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_10 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_10 (pin B12) is configured as PIO0_10 */ PORT_SetPinConfig(PORT0, 31U, &port0_31_pinB12_config); const port_pin_config_t port0_28_config = { kPORT_PullDisable, kPORT_LowPullResistor, kPORT_FastSlewRate, kPORT_PassiveFilterDisable, kPORT_OpenDrainDisable, kPORT_LowDriveStrength, /* Pin is configured as PIO0_6 */ kPORT_MuxAlt0, kPORT_InputBufferEnable, kPORT_InputNormal, kPORT_UnlockRegister}; /* PORT0_6 (pin C14) is configured as PIO0_6 */ PORT_SetPinConfig(PORT0, 28U, &port0_28_config); const port_pin_config_t port0_2_pinB16_config = { .pullSelect = kPORT_PullDisable, .pullValueSelect = kPORT_LowPullResistor, .slewRate = kPORT_FastSlewRate, .passiveFilterEnable = kPORT_PassiveFilterDisable, .openDrainEnable = kPORT_OpenDrainDisable, .driveStrength = kPORT_HighDriveStrength, /* Pin is configured as SWO */ .mux = kPORT_MuxAlt1, .inputBuffer = kPORT_InputBufferEnable, .invertInput = kPORT_InputNormal, .lockRegister = kPORT_UnlockRegister}; /* PORT0_2 (pin B16) is configured as SWO */ PORT_SetPinConfig(PORT0, 2U, &port0_2_pinB16_config); const port_pin_config_t port1_8_pinA1_config = { .pullSelect = kPORT_PullUp, .pullValueSelect = kPORT_LowPullResistor, .slewRate = kPORT_FastSlewRate, .passiveFilterEnable = kPORT_PassiveFilterDisable, .openDrainEnable = kPORT_OpenDrainDisable, .driveStrength = kPORT_LowDriveStrength, /* Pin is configured as FC4_P0 */ .mux = kPORT_MuxAlt2, .inputBuffer = kPORT_InputBufferEnable, .invertInput = kPORT_InputNormal, .lockRegister = kPORT_UnlockRegister}; /* PORT1_8 (pin A1) is configured as FC4_P0 */ PORT_SetPinConfig(PORT1, 8U, &port1_8_pinA1_config); const port_pin_config_t port1_9_pinB1_config = { .pullSelect = kPORT_PullDisable, .pullValueSelect = kPORT_LowPullResistor, .slewRate = kPORT_FastSlewRate, .passiveFilterEnable = kPORT_PassiveFilterDisable, .openDrainEnable = kPORT_OpenDrainDisable, .driveStrength = kPORT_LowDriveStrength, /* Pin is configured as FC4_P1 */ .mux = kPORT_MuxAlt2, .inputBuffer = kPORT_InputBufferEnable, .invertInput = kPORT_InputNormal, .lockRegister = kPORT_UnlockRegister}; /* PORT1_9 (pin B1) is configured as FC4_P1 */ PORT_SetPinConfig(PORT1, 9U, &port1_9_pinB1_config); } At the same time, add the following includes to the file: Habib_MS_0-1781207973118.png Spoiler (Highlight to read) #include "fsl_common.h" #include "fsl_port.h" #include "board.h" #include "clock_config.h" #include "pin_mux.h" #include "fsl_common.h" #include "fsl_port.h" #include "board.h" #include "clock_config.h" #include "pin_mux.h" Adding include paths Since we are including header files into the project, we must specify which directories to search in order to find the required files. To do this: 1. Open project properties (right-click on project > Properties). 2.Click on the drop menu “C/C++ Build”, then “Settings”. 3.Click on “Includes” option. Habib_MS_1-1781208012765.png 4.Click on the “Add..” button at the top right corner of the “Include paths (-l)” menu. 5. Click on “Workspace…” Habib_MS_2-1781208068003.png 6. Add the following highlighted directories from FRDM-MCXN project: Habib_MS_3-1781208097487.png 7. Accept the changes and click on “Apply and Close”. Add “root folder” to source location 1.Open project properties. 2. Click on the drop menu “C/C++ General”, then “Paths and Symbols”. 3. Click on the “Source Location” tab. 4.Click on “Add Folder…” and add the “ ”. Habib_MS_4-1781208199983.png Delete phOsal files We must delete from the path “phOsal > src > NullOs > portable” the files: “phOsal_Port_CM3.c”,“phOsal_Port_PN76xx.c” and “phOsal_Port_PN74xxxx.c”. This has the purpose of avoiding any multiple definition errors when compiling the final project. Add _DSB and _ISB support As final modification step, please include in NxpNfcRdLib->comps->phhalHw->src->PN5190-> phhalHw_Pn5190_Int.c the  “cmsis_gcc.h” to support of _DSB and _ISB functions. Habib_MS_5-1781208264265.png Testing Final Project Without OS After making all the previous changes and modifications, the migration is now complete, and we can proceed to compile and flash the example to MCXN947. Please “clean” the project before building by right clicking on the project as follows: Habib_MS_6-1781208329457.png To run the project, we will need a serial terminal like Tera Term with the following settings: - 115200 baud rate. - 8 data bits. - No parity. - One stop bit, - No flow control. Once the program is flashed and the serial terminal configured, we can reset the board and power the PNEV5190BP. You should see an output similar to the following: Habib_MS_7-1781208358485.png Now if any NFC tag is close to the PNEV5190BP’s antenna, you should see the information displayed as shown in the image below: Habib_MS_8-1781208378570.png Adding FreeRTOS support This section presents the steps to follow to add FreeRTOS support to the current project with the possibility of easily choosing either to have OS support or not. 1. Open the “Manage SDK Components” in properties->SDK Management. Habib_MS_9-1781208421419.png 2. Search the FreeRTOS kernel component (NXP integration layer), heap 4 and add it to your project. Habib_MS_0-1785533111303.png Note: If this option does not appear, you will have to download the SDK with the FreeRTOS stack included. Adding porting-specific files to FreeRTOS folder We need to set the core-specific files which define core register addresses and the assembly instructions that integrate the FreeRTOS kernel functions. The core integrating the MCXN947 IC is the Cortex M33 with Trust Zone, therefore, the folder that we will use to add the port files will be from the folder “ARM_CM33_NTZ” as explained below: 1. Import the SDK example called “freertos_hello_cm33_core0”: Habib_MS_11-1781208505026.png 2. Inside this example, you will see the folder “GCC” from the path freertos>freertoskernel>portable>GCC, please copy and paste this folder into the same path of the project. Habib_MS_2-1785533633824.png Habib_MS_3-1785533645497.png Adding port-specific created folder to include path. Now we need to tell the compiler where to find the port-specific files we just added to the project, to accomplish this: 1. Open the project properties (right-click on project > Properties) and click on “C/C++ General” and on “Paths and symbols”. Habib_MS_14-1781208609258.png 2. Here we will click on “Add…” and then “Workspace”. In the new tab we will search the last folder of the path we created (freertos/freertoskernel/portable/GCC/ARM_CM33_NTZ/non-secure), select it and click on “OK” Habib_MS_1-1785533523574.png 3. Repeat this step in project > Properties > “C/C++ Build” >Settings >“Includes”. Habib_MS_16-1781208764822.png Changing OS preprocessor macro Finally, we just need to tell the compiler that we want to run the example with FreeRTOS, to do this: 1. Open the project properties (right-click on project > Properties) and click on “C/C++ Build”, then on “Settings” and on “Preprocessor”. Habib_MS_17-1781208849806.png 2. Now find the previous macro named “PH_OSAL_NULLOS”, double click on it and change it to “PH_OSAL_FREERTOS” Habib_MS_18-1781209097027.png 3. Click on “Apply and Close” and click on “Rebuild Index”. 4. To avoid multiple definition issues when we change between NULLOS and FREERTOS, we will discard the SysTickHandler for FREERTOS side located in port.c when the NULLOS macro is defined, as shown the following image: Habib_MS_0-1781896206808.png Spoiler (Highlight to read) #ifndef PH_OSAL_NULLOS void SysTick_Handler( void ) /* PRIVILEGED_FUNCTION */ { uint32_t ulPreviousMask; ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR(); traceISR_ENTER(); { /* Increment the RTOS tick. */ if( xTaskIncrementTick() != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); /* Pend a context switch. */ portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } else { traceISR_EXIT(); } } portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask ); } #endif #ifndef PH_OSAL_NULLOS void SysTick_Handler( void ) /* PRIVILEGED_FUNCTION */ { uint32_t ulPreviousMask; ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR(); traceISR_ENTER(); { /* Increment the RTOS tick. */ if( xTaskIncrementTick() != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); /* Pend a context switch. */ portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } else { traceISR_EXIT(); } } portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask ); } #endif 5. Finally, copy and paste the FreeRTOSConfig_Gen.h, FreeRTOSConfig.h and freertos_tasks_c_additions.h files from the freertos_hello example as shown the following image: Habib_MS_0-1785536616039.png Habib_MS_1-1785536639784.png Now you are able to build and debug following the chapter Testing Final Project Without OS but now with FreeRTOS. NFC Reader Library
查看全文
Can't add new pictures when using the software 1.9.1(无法添加图片) When I was using it the other day, I added new images (in PNG format) as usual, but it took a long time to load, and I couldn’t use other functions during that time. See picture 2. After I closed and restarted the software, I found that all the images in the previously uploaded library were gone, and I also couldn’t upload new images. See picture 1. 当我在某次使用的时候,像往常一样添加新的图片(PNG格式),却加载了很久,期间也无法使用别的功能。请看图二 当我把软件关闭重启后,发现之前上传的图片库里面的图片全都丢失了,并且也无法上传新的图片。请看图一 huang_yingxue_1-1785210488463.png huang_yingxue_0-1785210370827.png Re: Can't add new pictures when using the software 1.9.1(无法添加图片) Hi @huang_yingxue  Please try the latest GuiGuider version first and let us know whether the issue can be reproduced. If it still occurs, we can continue the investigation based on the additional information above. Thanks for your understanding. BR Harry
查看全文
How to become a EV powertrain deisgn engineer? How do I become better/employable as Ev powertrain deisgn engineer, what tools should I be familiar with is there anything I can do like make a portfolio to better showcase what ive learnt. Is there any practice assignments or materials online that could help me understand & practice more. My background: I'm new to EV industry, starting from scratch. It's a career change for me.i have degree in mechanical engineering. But was in a different career for past few years and never worked as an engineer.but was always passionate about EVs. So, To get back and brigde the gap I'm doing a course to learn more about ev design ,it's called master's in Ev powertrain design & validation. It's mainly modeling in matlab simulink and few practical on an EV. Alternator Regulator
查看全文
MCUXpresso IDE roadmap Hi everyone, Is MCUXpresso IDE still supported? In the last years there was a MCUXpresso IDE upgrade every about 4 months. Since june 2025 there is not upgrades. Does this mean that MCUXpresso IDE will not be upgraded in the future? Many thanks Biafra Re: MCUXpresso IDE roadmap Hello @biafra , Thanks for your post. At present, there are no plans for a new MCUXpresso IDE roadmap. Our primary focus and recommended development environment is MCUXpresso for Visual Studio Code | NXP Semiconductors. However, the latest MCUXpresso IDE v25.06 is still actively maintained, and you can continue to import and use SDKs for new devices without any issues. Please note that if you use the integrated Config Tools for newer products, make sure to update the Config Tools package manually. For detailed instructions, please refer to: Updating Config Tools in the MCUXpresso IDE - NXP Community. Hope it helps. BR Celeste
查看全文
导出 S32CT .mex配置到 EB Tresos 您好,NXP技术支持, 是否有办法导出/转换 S32CT 配置 .mex 文件?将文件转换成EB TRESOS可以读取/导入/使用的格式?我需要切换到 EB Tresos,但不想手动转移每个配置项。 我附上了一个示例 .mex 文件。我从我的项目中选取文件作为参考,引用。 Re: Exporting S32CT .mex configuration to EB Tresos 你好@DirkEtzler 遗憾的是,目前还没有自动转换工具或插件可以将 S32DS (.mex) 配置迁移到 EB tresos (.arxml) 格式。 S32 配置工具使用 .mex 文件格式,而 EB Tresos 遵循 .arxml 格式。AUTOSAR 标准在架构和约束方面有很大不同。   建议的方法是使用 .mex 文件在 EB Tresos 中手动重新创建配置。配置和生成的驱动程序代码作为参考,引用。您可以参考Tresos Training 提供的 RTD MCAL 指南来获取一些指导。   如果您在迁移过程中遇到任何问题,请提交您的查询,我们将很乐意为您提供帮助。   此致, 朱利安 Re: Exporting S32CT .mex configuration to EB Tresos 你好@Julián_AragónM , 感谢您的快速回复。我会遵守规则,遇到问题时再发帖提问。
查看全文
晶振波形异常 你好,@ lukaszadrapa 我们公司在使用贵公司的FS32K144HFT0MLHT这款MCU, 使用晶振为AV08000009这款8MHz的无源晶振,波形异常。请问这样的晶振波形 贵公司的MCU可以接受吗 是否会影响MCU的正常使用吗 IMG_20260718_141710.jpg Re: 晶振波形异常 嗨@Kyp 示波器截图似乎没有显示实际的 8 MHz 晶体波形。显示的频率(~256 Hz)与预期的振荡器频率不一致,很可能是由于所选示波器时基和采样率引起的混叠所致。因此,仅凭这一测量结果无法评估晶振(晶体振荡器)的质量。应该使用速度快得多的时基来观察实际的振荡器波形。 此致, Lukas Re: 晶振波形异常 HI ,lukaszadrapa   非常抱歉 ,我们用重新测了一下波形,图片如下 晶振波形.png 麻烦分析一下,有什么好的建议
查看全文
水晶発振器の波形異常 こんにちは、@lukaszadrapa 弊社では貴社製のFS32K144HFT0MLHTマイクロコントローラを使用しています。 8MHzの受動水晶発振器(AV08000009)を使用した場合、波形が異常になります。この波形は貴社製MCUにとって許容範囲内でしょうか? MCUの正常な動作に影響しますか? IMG_20260718_141710.jpg Re: 晶振波形异常 こんにちは、 @Kypさん オシロスコープのスクリーンショットには、実際の8MHz水晶発振器の波形が表示されていないようです。表示されている周波数(約256Hz)は、予想される発振器の周波数と一致しておらず、選択されたオシロスコープのタイムベースとサンプリングレートによるエイリアシングが原因である可能性が最も高い。したがって、この測定だけで結晶振動子の品質を評価することはできません。実際の発振器波形を観測するには、より高速な時間軸を使用する必要がある。 よろしくお願いいたします。 ルーカス Re: 晶振波形异常 こんにちは、 lukaszadrapa 申し訳ございません。波形を再検査したところ、以下の画像が得られました。 晶振波形.png これを分析して、何か提案があればお聞かせください。
查看全文
启用数据缓存 你好、 我正在测试 TFLite AI 模型在恩智浦 FRDM-MCXN947 MCU 上的推理时间和性能。虽然我使用 NPU 时性能不错,但不使用 NPU 时推理速度却相当慢。通过启用数据缓存,我能够缩短其他 MCU 的推理时间。我想知道如何在恩智浦微控制器上启用数据缓存。我们也欢迎任何其他性能提升策略。 MCX N NPU|ML Re: Enabling Data Cache 启用数据缓存可以真正加快工作流程,减少重复处理。对于那些希望进行有效规划的人来说,Persona 融合战略为预测结果和优化结果提供了一种明确的方法。将正确的元素结合在一起,能带来意想不到的效率,这真是令人着迷。这种方法无疑让复杂数据的管理变得更加简单易行。 Re: Enabling Data Cache 有意思您使用过编译器优化标志吗?通常,当 NPU 处于非活动状态时,加强优化(例如 -O3)可以显著加快代码速度。另外,关于数据缓存,请查看 SDK 文档中有关 Cache_enable 或类似函数,特别是适用于 MCXN947 的函数。请记住,优化通常归结为一种平衡行动,就像在 Slope Game 中一样,优化代码与硬件限制以获得最佳性能。祝你好运 Re: Enabling Data Cache 你好@ge0rgeth0mas CACHE64 模块用于缓存 FlexSPI 访问。 根据您的需要,只需启用 lpcache 即可。 BR 哈利 Re: Enabling Data Cache 很高兴看到您在恩智浦 FRDM-MCXN947 上探索 TFLite AI 模型!启用 数据缓存 确实可以显著提高性能。您还可以优化模型大小或量化模型,以提高效率。说到性能,你有没有尝试过将其与 Snow Rider 3D 游戏等游戏应用程序内置?这可能是测试设置能力的一种有趣方式! Re: Enabling Data Cache 你好 Harry,正如你所提到的, 我正在浏览参考手册和 SDK 驱动程序: 我注意到有 * fsl_cach_lpcac.h其中包含L1CACHE_EnableCodeCache() 和 * fsl_cache.h其中包含CACHE64_EnableCache(CACHE64_CTRL_Type *base) CACHE64 可能是数据高速缓存,LPCAC 可能是指令高速缓存? Re: Enabling Data Cache 嗨,哈里、 CACHE64 可能是数据高速缓存,LPCAC 可能是指令高速缓存? Re: Enabling Data Cache 你好@ge0rgeth0mas 您可以参阅 MCX Nx4x 参考手册中的第 5 章。 Snipaste_2025-02-25_17-55-06.png 关于缓存相关的应用程序接口。 您可以参考 MCXN947 SDK 中的 fsl_cache_lpcac.h。 Snipaste_2025-02-25_17-58-52.png BR 哈利 Re: Enabling Data Cache 这是一项令人着迷的工作!我以前也参与过类似的优化挑战。您是否为 TFLite 模型探索过不同的量化技术?有时,即使是很小的调整,也会在 NPU 未启动时产生不同的效果。说到快节奏的动作,它让我想起了玩 篮球明星!它要求快速反应和策略,就像优化人工智能一样。当你需要从编码工作中解脱出来时,你可能会发现这是一种有趣的分心方式。 Re: Enabling Data Cache FRDM-MCXN947 的工作很有意思!你正在探索不同的性能优化方法,这很好。我没有使用过这种特定的 MCU,但在很多情况下,启用数据缓存肯定会带来不同。您可能会从专注于嵌入式开发的社区中找到一些有用的见解,甚至可能会从那些讨论类似游戏优化挑战的社区中找到一些有用的见解、 绥卡游戏!有时候,提高游戏开发效率的方法可以出人意料地得到很好的转化。祝你的项目好运! Re: Enabling Data Cache 感谢您分享这个问题。硬件加速虽然备受关注,但对于边缘人工智能应用而言,CPU 端优化仍然非常重要。缓存配置、内存对齐、CMSIS-NN 优化和编译器标志绝对是值得探索的领域。这与在《漂移老大》等游戏中逐步提高技能的理念相同——随着时间的推移,微小的调整可以带来更好的结果。 Re: Enabling Data Cache 您的 NPU 测试结果听起来很有希望,而 CPU 的差距可能确实指向缓存或内存放置问题。除了启用 数据缓存 之外,还要检查模型张量和权重是否放置在快速 SRAM 中,确认编译器优化标志,并我的各个运算符以找出瓶颈。将 CMSIS-NN 内核与默认的 TFLite 实现进行比较也可能有所帮助。与优化Slope Unblocked类似,内存访问的微小变化可以显著提高响应速度。
查看全文
S32K144 GPT 通知回调在 SRTC 通道上未触发信号 - MCAL RTM 1.0.6 (AUTOSAR 4.2) + EB 您好,NXP团队, 我正在使用以下 S32K144 进行项目开发: MCAL 软件包:S32K1XX_MCAL4_2_RTM_1_0_6 AUTOSAR 版本:4.2.2 EB Tresos 版本:29.0 设备:S32K144 我遇到的问题是,尽管计时器本身似乎运行正常,但 GPT 通知回调却没有收到触发信号。 GPT 配置 EB Tresos 中 GPT 通道的配置如下: 硬件模块:SRTC 频道:SRTC_0_CH_0 模式:连续 通知:已启用 extern void Gpt_Notification(void); static CONST(Gpt_ChannelConfigType, GPT_CONST) Gpt_InitChannelPB[1] = { { (布尔值)FALSE, &Gpt_Notification, ... (Gpt_ChannelModeType)(GPT_CH_MODE_CONTINUOUS), { (uint8)(SRTC_0_CH_0), (uint8)(GPT_SRTC_MODULE) ... } } }; Gpt_GetTimeElapsed()(在应用程序代码中使用)返回的值在运行时持续增加,这表明: GPT初始化成功。 GPT定时器启动成功。 SRTC计时器计数正常。 然而: Gpt_Notification() 函数从未被调用。 Gpt_Notification() 函数内部的断点永远不会被触发。 请问您能否帮忙澄清一下: S32K1XX_MCAL4_2_RTM_1_0_6 中 SRTC_0_CH_0 上的 GPT 通知是否存在已知问题? 基于 SRTC 的 GPT 是否需要在 GPT 模块配置之外进行任何额外的 NVIC 或中断配置? 或者其他任何可能被遗漏的要点。 此致, 艾西瓦娅 Re: S32K144 GPT Notification Callback Not Triggering on SRTC Channel - MCAL RTM 1.0.6 (AUTOSAR 4.2) 嗨@Aishwr 请检查: EB Tresos 中的 GptIsrEnable - 转到 Gpt -> GptHw配置-> GptHwInterruptChannel。找到 SRTC_0_CH_0 的条目。检查 GptIsrEnable 和 GptChannelIsUsed 是否都已启用。这两个值的默认值均为 false,因此必须显式启用,否则 SRTC 信道的 ISR 将不会激活。 在应用程序代码中调用 Gpt_EnableNotification() - 仅仅在 EB Tresos 中配置通知功能是不够的。在 Gpt_StartTimer() 之后,必须在应用程序中显式调用 API Gpt_EnableNotification(GptConf_GptChannelConfiguration_ )。如果没有这个调用,即使定时器正确触发,司机也不会发送通知。 中断控制器初始化 – 根据用户手册中提到的驱动程序偏差 SWS_Gpt_00355 和 SWS_Gpt_00356,集成代码必须在使用 GPT 驱动程序之前启用 NVIC 中的 RTC/SRTC 中断线。这不是 Gpt_Init() 函数能做到的。请检查此操作是否在您的启动代码或集成代码中执行,以及是否在调用 Gpt_StartTimer() 之前执行。 此致, Lukas
查看全文
How to Blob FLUSH S32E288-975EVB Hello, my company is exploring using this chip for our new product.  I am having trouble getting the code built and flashed through micro-USB UART onto the board. I was able to FLUSH the pre-built "Hello world" print binaries that come with the RTD package to the board and tested working, so I know it is possible, but when I want to do this with my own code, I could not find any instructions on how to do this. There are no linker_flash files in Project_setting/Linker_files/ in any examples from RTD, and there is no mention of how to do this in the manual. Am I supposed to build in JTAG debug RAM mode and manually use IVT? What is the procedure? How do I build a UART flashable file? If anyone can point me in the right direction, it would be much appreciated.  I found this on this forum: https://community.nxp.com/t5/S32Z-E/creating-a-Blob-Image-using-IVT-S32Z2/m-p/2362406#M322 I am not sure if this works, since this is not closed, but I will try. If there is any support for this board, that would be great.  Re: How to Blob FLUSH S32E288-975EVB Hi,pyc About how to create a Blob, from starting the Flash, you can refer to the following content. 1.The recommended startup method we suggest is the one like GreenVIP's, starting from SMU and then proceeding to R52. You can refer to GreenVIP for details. In GreenVIP, there are also instructions on how to create Blobs and how to burn Blobs. S32ZE_GreenVIP_1.3.x/doc/UG_S32ZE_GreenVIP.pdf Design : Product Information : Automotive SW - S32Z/E - Vehicle Integration Platform (GreenVIP) Joey_z_0-1785465893182.png 2. To start directly from R52, you need to modify the link script and startup file. It's a bit complicated. You can refer to the following link, which has supported similar situations. Guidance for IVT Flash Image Creation for R52_0_0 Core on S32Z280-594EVB Without Debug Probe. How to reduce the binary size in S32Z2 3. About the QSPI boot mode setting of S32E288-975EVB, you can refer to this picture form user-guide of S32E288-975EVB. S32E288-975EVB Evaluation Board Solution for S32E2 Family Microcontrollers User Guide Joey_z_1-1785466091287.png BR Joey Re: How to Blob FLUSH S32E288-975EVB Hi,pyc Thank you for contacting us. The design file on your website is also missing the schematics, so I am unable to check from my side. Any help is appreciated. >>>You can find the design documents and Start Guide for S32E288-975EVB on the official website interface as the following picture. S32E288-975EVB Evaluation Board | NXP Semiconductors Joey_z_0-1785463510142.png Joey_z_1-1785463528493.png BR Joey Re: How to Blob FLUSH S32E288-975EVB Hi, so the Example diode code is trying to toggle D12, and the get-started guide on your website for S32E288-975EVB is using information from S32E288-400EVB. The design file on your website is also missing the schematics, so I am unable to check from my side. Any help is appreciated. Re: How to Blob FLUSH S32E288-975EVB Quick update. I tried the exact same procedure for the Dio example, and was able to create the blob file. I flushed it onto the board, and the LED is not blinking. The flush procedure is definately correct since I was able to flush the some pre-build artifacts I found inside the IDE folder. Have anyone verified this procedure at NXP that this procedure actually work on this dev kit?
查看全文
S32K144 GPT Notification Callback Not Triggering on SRTC Channel - MCAL RTM 1.0.6 (AUTOSAR 4.2) + EB Hello NXP Team, I am working on an S32K144 project using: MCAL Package: S32K1XX_MCAL4_2_RTM_1_0_6 AUTOSAR Version: 4.2.2 EB Tresos Version: 29.0 Device: S32K144 I am facing an issue where a GPT notification callback is not being triggered, although the timer itself appears to be running correctly. GPT Configuration The GPT channel is configured in EB Tresos as: Hardware Module: SRTC Channel: SRTC_0_CH_0 Mode: Continuous Notification: Enabled extern void Gpt_Notification(void); static CONST(Gpt_ChannelConfigType, GPT_CONST) Gpt_InitChannelPB[1] = { { (boolean)FALSE, &Gpt_Notification, ... (Gpt_ChannelModeType)(GPT_CH_MODE_CONTINUOUS), { (uint8)(SRTC_0_CH_0), (uint8)(GPT_SRTC_MODULE), ... } } }; The value returned by Gpt_GetTimeElapsed()(used in application code ) continuously increases during runtime, indicating that: GPT initialization is successful. GPT timer starts successfully. SRTC timer is counting correctly. However: Gpt_Notification() is never called. Breakpoint inside Gpt_Notification() is never hit. Could you please help clarify: Is there any known issue with GPT notifications on SRTC_0_CH_0 in S32K1XX_MCAL4_2_RTM_1_0_6? Does SRTC-based GPT require any additional NVIC or interrupt configuration outside the GPT module configuration? or any other point, that may have missed. Regards, Aishwarya Re: S32K144 GPT Notification Callback Not Triggering on SRTC Channel - MCAL RTM 1.0.6 (AUTOSAR 4.2) Hi @Aishwr  Please check: GptIsrEnable in EB Tresos - Go to Gpt -> GptHwConfiguration -> GptHwInterruptChannel. Find the entry for SRTC_0_CH_0. Check that both GptIsrEnable and GptChannelIsUsed are enabled. The default value for both of these is false, so they must be explicitly turned on, otherwise the ISR for the SRTC channel will not be active. Gpt_EnableNotification() call in your application code - Configuring the notification function in EB Tresos is not enough on its own. The API Gpt_EnableNotification(GptConf_GptChannelConfiguration_ ) must be called explicitly in your application after Gpt_StartTimer(). Without this call, the driver will not deliver the notification even if the timer fires correctly. Interrupt controller initialization – per driver deviations SWS_Gpt_00355 and SWS_Gpt_00356 mentioned in user manual, integration code must enable the RTC/SRTC interrupt line in the NVIC before using the GPT driver. This is not done by Gpt_Init(). Please check whether this is done in your startup or integration code, and whether it happens before Gpt_StartTimer() is called. Regards, Lukas
查看全文
Rx sensitivity differs by 10dB between consecutive measurements I am observing unexpected behavior for one of our products using QN9083 BLE SoC. When I measure the device receiver sensitivity, I am seeing deltas up to 10dB between consecutive measurements. I am using a CMW100 in advertiser mode to perform measurement and the device is placed in a shielded RF box. Performing consecutive RxS measurements, without opening the box and/or changing device location, the device responds with up to 10dB difference (i.e., -91dBm and -81dBm) which is unexpected and never happened before. The behavior is random. I am looking for possible causes both hardware and software. Re: Rx sensitivity differs by 10dB between consecutive measurements Hello, A variation of up to 10 dB between consecutive sensitivity measurements is not something we would normally expect. Could you share the software/SDK version currently being used? Also, can you clarify: Does this occur on a single device or multiple products? Have you seen the same behavior across different units? Can the issue be reproduced on an NXP development board using the same measurement setup? This information will help determine whether the issue is specific to the hardware, software, or test environment. Best Regards, Ricardo Re: Rx sensitivity differs by 10dB between consecutive measurements Hello thank you for getting back to me. Here are my answers: Could you share the software/SDK version currently being used?       5.0 based on 156414 (Controller Subsystem) and 156821 (Host Subsystem) Does this occur on a single device or multiple products?       Same product. Never had the issue with different products. Have you seen the same behavior across different units?       Yes but not consistently Can the issue be reproduced on an NXP development board using the same measurement setup?       I will need a dev board with QN9083 and a FW that will set the chip on advertising Thank you,       Re: Rx sensitivity differs by 10dB between consecutive measurements Additional info regarding BLE version: SDK 2.2.3 BLE 1.5.6 that supports BLE Core 5.0. Re: Rx sensitivity differs by 10dB between consecutive measurements @Ricardo_Zamora  I ran measurements using QN9080-DK. Although I do not see 10dB discrepancy there is still 5dB fluctuation (see data below). What could cause this?  furbani_0-1784214895282.png Re: Rx sensitivity differs by 10dB between consecutive measurements Hi @Ricardo_Zamora did you get the chance to look into the data/answers I posted? Thank you.
查看全文
T2081プロセッサMT29F64G08AECAB NANDフラッシュへのアクセス こんにちは、 T2081プロセッサを使ってMT29F64G08AECAB NANDフラッシュにアクセスしようとしています。 NANDフラッシュデバイスの総容量は8GBで、CE1(Chip Enable 1)とCE2(Chip Enable 2)はそれぞれCS5とCS6を介してIFCコントローラに接続されています。 CS5はCE1に接続された4GBのNANDフラッシュに使用されます。 CS6はCE2に接続された4GBのNANDフラッシュに使用されます。 このNANDデバイスのXMLフラッシュ構成ファイルは、以下のパスに存在しません。 {CodeWarrior}\PA\bin\plugins\support\Products\ProductData\FPDevices.mwpdb\FP そこで、Flash Programmer for Power Architectureプロセッサ アプリケーションノート(AN4349)という文書を参照して新しいXMLファイルを作成しました。 私には以下の質問があります。 フラッシュプログラマの設定ファイル(.xml)では、NANDフラッシュのサイズを4GB (チップセレクトあたり)に設定すべきでしょうか、それとも8GB (CS5とCS6を合わせたデバイス全体の容量)に設定すべきでしょうか? CS5の4GBサイズのNANDフラッシュ構成に合わせて、T2081QDS_init_core.tclファイルを修正しました。 製造元IDとデバイスIDを読み取るための診断テストを実行すると、コンソールに次のエラーが表示されます。   Vimalprasad_1-1784808486863.png 参考資料として、T2081QDS_init_core.tclファイルとMT29F64G08AECAB.xmlファイルを添付しました。 設定を確認し、 T2081プロセッサを使ってNANDフラッシュデバイスにアクセスする正しい手順を教えていただけますか? よろしくお願いいたします。 ヴィマル。 QorIQ T2デバイス Re: Accessing MT29F64G08AECAB NAND Flash on T2081 Processor こんにちは、 現在タイムアウトが発生している可能性が最も高い原因は、 TCL のチップセレクトインデックスの誤り、 IFC クロックの初期化不足、 CSOR ページ/ブロックのジオメトリの不一致、タイミングが厳しすぎる、または正しい NAND ID シーケンスを実装していないアルゴリズムを指す XML エントリです。実際のXMLと修正 T2081QDS_init_core.tcl されたCS5/CS6のセクションを共有してくれれば、フィールドを直接確認して値を登録できます。 フラッシュプログラマのターゲット/チップセレクトごとに4GBを使用し、最初にCS5のみを起動して、IDタイムアウトを8GBのXMLサイズの問題としてではなく、IFCの初期化/アルゴリズム/ジオメトリの問題としてデバッグしてください。   よろしくお願いします。 Re: Accessing MT29F64G08AECAB NAND Flash on T2081 Processor こんにちは、 @Bio_TICFSL さん、 ご回答ありがとうございます。 Chip Select 5(CS5)を使って4GBのNANDフラッシュにアクセスしようとしましたが、先ほど述べた問題が依然として解決しています。 参考資料として、 T2081QDS_init_core.tclファイルとテキスト形式のXMLファイルを添付しました。 これらのファイルと設定値をご確認いただき、適切な解決策を教えていただけますか? よろしくお願いいたします。 ヴィマル。 Re: Accessing MT29F64G08AECAB NAND Flash on T2081 Processor こんにちは、   前回の返信について、まだご回答をいただいていないため、改めてご連絡いたします。   MT29F64G08AECAB NANDフラッシュのタイミングパラメータに関して、いくつか疑問があります。添付のデータシート画像にあるタイミング表をご参照ください。 Vimalprasad_0-1785412853020.png NXP T2081 IFCインターフェースでどのNANDタイミングモードを使うべきでしょうか?   これらのタイミング値から、対応する入力クロックサイクルはどのように導き出されるのでしょうか?   NxP T2081プロセッサからIFC経由でNANDフラッシュ(MT29F64G08AECAB)にアクセスする方法について、アドバイスをいただけますか? よろしくお願いいたします。 ヴィマル。
查看全文
S32K344EVB-T172: オンボードのOpenSDAデバッガーに接続できません こんにちは、 私はS32K344EVB-T172を使用していますが、オンボードのOpenSDA/PEmicroデバッガに接続できません。 デバッグ用USBケーブルを接続しても、デバッグLEDが点灯せず、オンボードデバッガーがPCに認識されないため、デバッグセッションを開始できない場合があります。 私は既に以下のことを試しました: 複数のUSBデータケーブル 異なるUSBポート ボードをリセットして電源を入れ直す 外部ハードウェアがコネクテッドされていない状態でテストしています 以前にこの問題に遭遇した方はいますか?オンボードのOpenSDAデバッガに関して、推奨される復旧手順、ファームウェアのアップデート、またはハードウェア/ジャンパーのチェック方法はありますか? よろしくお願いします。 Re: S32K344EVB-T172: Unable to Connect to the Onboard OpenSDA Debugger ご返信ありがとうございます。 はい、PEmicroドライバを最新バージョンに更新しました。以前はEVBのフラッシュとデバッグを正常に行えていましたが、最近、デバッグ用USBを接続してもデバッグLEDが点灯しないため、オンボードのOpenSDAデバッガーが検出されないことがあります。 S32K3X4EVB-T172クイックスタートガイドに従って、ジャンパーが正しく設定されていることも確認しました。追加のチェックやOpenSDAファームウェアの復旧手順が推奨されるか、あるいはハードウェアの問題を示している可能性はありますか? Re: S32K344EVB-T172: Unable to Connect to the Onboard OpenSDA Debugger こんにちは、 @SourabhJ さん PEmicroのドライバは最新バージョンに更新しましたか?以前、EVBの書き換えに成功しましたか? また、 MCU自動車ボードのクイックスタートの「S32K3X4EVB-T172評価ボードのジャンパー設置」セクションで説明されている通りにジャンパーが設定されているかも確認していただけますか? BR、VaneB Re: S32K344EVB-T172: Unable to Connect to the Onboard OpenSDA Debugger こんにちは、 @SourabhJ さん LEDのD14とD15だけが点灯していないのか、それとも電圧レギュレーターの隣にある3つのLEDもオフなのか確認していただけますか? もしPEMicro MultilinkやSEGGER J-Linkのような外部デバッガにアクセスできるなら、基板のJ12(20ピンCortex Debug)コネクタで接続してみてはどうでしょうか?これにより、S32K344 MCUがオンボードデバッガに依存して正しく応答しているかどうかを確認できます。 また、この問題が起きる前に最後にボードにプログラムされたアプリケーションやファームウェアは何ですか?
查看全文
如何成为一名电动汽车动力传动设计工程师? 我如何才能成为一名更优秀/更有竞争力的电动汽车动力传动设计工程师?我应该熟悉哪些工具?我是否可以做一些事情,比如制作作品集,来更好地展示我所学到的知识? 网上有没有什么练习题或资料可以帮助我理解和练习? 我的背景:我是电动汽车行业的新手,一切都从零开始。对我来说,这是一次职业转型。我拥有机械工程学位。但过去几年我从事的是其他职业,从未做过工程师,但我一直对电动汽车充满热情。 所以,为了回到正轨并弥合差距 我正在学习一门关于电动汽车设计的课程,叫做电动汽车动力传动设计&验证硕士课程。主要内容是使用 Matlab Simulink 进行建模,很少涉及电动汽车的实际操作。 交流发电机稳压器
查看全文
Accessing MT29F64G08AECAB NAND Flash on T2081 Processor Hi, I am trying to access the MT29F64G08AECAB NAND Flash using the T2081 processor. The NAND Flash device has a total capacity of 8 GB, with CE1 (Chip Enable 1) and CE2 (Chip Enable 2) connected to the IFC controller through CS5 and CS6, respectively. CS5 is used for 4 GB of NAND Flash connected to CE1. CS6 is used for 4 GB of NAND Flash connected to CE2. The XML flash configuration file for this NAND device is not available in the following path: {CodeWarrior}\PA\bin\plugins\support\Products\ProductData\FPDevices.mwpdb\FP Therefore, I created a new XML file by referring to the document Flash Programmer for Power Architecture Processors Application Note (AN4349). I have the following questions: For the Flash Programmer configuration file (.xml), should I configure the NAND Flash size as 4 GB (per chip select) or 8 GB (total device capacity across CS5 and CS6)? I modified the T2081QDS_init_core.tcl file according to the NAND Flash configuration on CS5 with a 4 GB size. When running the diagnostic test to read the Manufacturer ID and Device ID, I encounter following errors in the console.   Vimalprasad_1-1784808486863.png I have attached the T2081QDS_init_core.tcl and MT29F64G08AECAB.xml files for your reference. Could you please review the configuration and provide the correct procedure to access the NAND Flash device using the T2081 processor? Regards, Vimal. QorIQ T2 Devices Re: Accessing MT29F64G08AECAB NAND Flash on T2081 Processor Hello, The most likely causes of your current timeout are: wrong chip-select index in the TCL , IFC clock not initialized , CSOR page/block geometry mismatch , timing too aggressive , or an XML entry pointing to an algorithm that does not implement the correct NAND ID sequence . If you share the actual XML and the modified T2081QDS_init_core.tcl CS5/CS6 sections, I can check the fields and register values directly. Use 4 GB per Flash Programmer target/chip select, bring up CS5 alone first, and debug the ID timeout as an IFC initialization/algorithm/geometry issue rather than as an 8 GB XML-size issue.   Regards Re: Accessing MT29F64G08AECAB NAND Flash on T2081 Processor Hi @Bio_TICFSL , Thanks for your response, We tried using Chip Select 5 (CS5) to access the 4 GB NAND flash, but we are still facing the same issue that was mentioned previously. I have attached the T2081QDS_init_core.tcl file and the xml file in text format for your reference. Could you please review these files and the configuration values, and provide the appropriate solution? Regards, Vimal. Re: Accessing MT29F64G08AECAB NAND Flash on T2081 Processor Hi,   I am following up on my previous reply, as I have not yet received a response.   I have some doubts regarding the timing parameters of the MT29F64G08AECAB NAND Flash. Please refer to the timing table in the attached datasheet image. Vimalprasad_0-1785412853020.png Which NAND timing mode should be used with the NXP T2081 IFC interface?   How are the corresponding input clock cycles derived from these timing values?   Can you please give the suggestions to access the NAND Flash (MT29F64G08AECAB) through IFC from the NxP T2081 Processor? Regards, Vimal.
查看全文
S32K344EVB-T172:无法连接到板载 OpenSDA 调试器 你好, 我正在使用S32K344EVB-T172 ,但无法连接到板载OpenSDA/PEmicro调试器。 有时,当我连接调试 USB电缆时,调试 LED 灯不会亮起,PC 也检测不到板载调试器,导致我无法启动调试会话。 我已经尝试过了: 多根USB数据线 不同的 USB 端口 重置并重启电路板 测试时未连接任何外部硬件 之前有人遇到过这个问题吗?对于板载 OpenSDA 调试器,是否有推荐的恢复程序、固件更新或硬件/跳线检查方法? 谢谢! Re: S32K344EVB-T172: Unable to Connect to the Onboard OpenSDA Debugger 感谢您的反馈, 是的,我已经将PEmicro驱动程序更新到最新版本。我之前能够成功地对 EVB 进行烧录和调试,但最近板载 OpenSDA 调试器有时无法被检测到,因为连接调试 USB 后调试 LED 灯不会亮起。 我还确认跳线已按照 S32K3X4EVB-T172 快速入门指南正确设置。请问是否建议进行其他检查或采取 OpenSDA 固件恢复步骤,或者这是否可能表明存在硬件问题? Re: S32K344EVB-T172: Unable to Connect to the Onboard OpenSDA Debugger 嗨@SourabhJ 您是否已将 PEmicro 驱动程序更新到最新版本?您之前是否成功刷写过EVB? 您能否也确认一下跳线是否按照MCU 汽车板快速入门指南中的“在 S32K3X4EVB-T172 评估板上设置跳线”部分所述进行配置? BR,VaneB Re: S32K344EVB-T172: Unable to Connect to the Onboard OpenSDA Debugger 嗨@SourabhJ 请问是否只有 LED D14 和 D15 不亮,还是电压调节器旁边的三个 LED 也都不亮? 如果您可以使用外部调试器,例如 PEMicro Multilink 或 SEGGER J-Link,能否尝试通过板上的 J12(20 针 Cortex 调试)连接器进行连接?这将有助于我们验证 S32K344 MCU 是否仍然能够正常响应,而无需依赖板载调试器。 另外,在出现此问题之前,最后写入板的应用程序或固件是什么?
查看全文