/****************************************************************************** ** \brief Initialize CSIO I/F to control CAN FD transceiver ** ** Initializes the MFS as the CSIO to control the CAN FD transceiver. ** This function premises following environment; ** > Implemented CAN FD transceiver is NXP TJA1145T/FD. ** > Following CSIO signals are connected to the transceiver; ** CAN FD 0 : MFS ch.12 - SCK12_1, SIN12_1, SOT6_12, CS: P0F ******************************************************************************/ static void CanfdDriverInit(void) { stc_mfs_csio_config_t stcCsioConfig; PDL_ZERO_STRUCT(stcCsioConfig); // Assign pins for MFS/CSIO SetPinFunc_SCK12_1(); SetPinFunc_SIN12_1(); SetPinFunc_SOT12_1(); // CS P7E Gpio1pin_InitOut(GPIO1PIN_P7E, Gpio1pin_InitVal(1u)); // Initialize CSIO stcCsioConfig.enMsMode = CsioMaster; stcCsioConfig.enActMode = CsioActNormalMode; stcCsioConfig.bInvertClk = TRUE; stcCsioConfig.u32BaudRate = 500000; stcCsioConfig.enDataLength = CsioSixteenBits; stcCsioConfig.enBitDirection = CsioDataMsbFirst; stcCsioConfig.enSyncWaitTime = CsioSyncWaitZero; stcCsioConfig.pstcFifoConfig = NULL; // Initialize CSIO Mfs_Csio_Init(&CSIO12, &stcCsioConfig); }
static void my_gpio_test(void) { // GPIO Pin Init Output Gpio1pin_InitOut( GPIO1PIN_P30, Gpio1pin_InitVal( 0u ) ); // Init Output P30,Output Value: 0 Gpio1pin_InitOut( GPIO1PIN_P31, Gpio1pin_InitVal( 0u ) ); // Init Output P31,Output Value: 0 // GPIO Output Value change Gpio1pin_Put( GPIO1PIN_P31, 1u); // Output P31, Value: 1 // GPIO1PIN_P32; GPIO1PIN_NP32, inverted; Gpio1pin_InitOut( GPIO1PIN_NP32, Gpio1pin_InitVal( 0u ) ); // Init inverted Output P52, Value: 0 Gpio1pin_Put( GPIO1PIN_NP32, 1u); // Output inverted P52, Value: 1 //输出反向, 配置1u, 实则输出低电平; // gpio PIN INIT INPUT Gpio1pin_InitIn ( GPIO1PIN_P51, Gpio1pin_InitPullup( 0u ) ); // Init Input P51 if (1u == Gpio1pin_Get( GPIO1PIN_P51 )) // Read P51 {} // gpio pin init input (invert port) Gpio1pin_InitIn ( GPIO1PIN_NP53, Gpio1pin_InitPullup( 0u ) ); // Init inverted Input P53 if (1u == Gpio1pin_Get( GPIO1PIN_NP53 )) // Read inverted P53 {} //Pin Function Config //SetPinFunc_INT11_1(0u); // Pin Function: INT11_0 // ----------- // Straight forward port names GpioInitIn(P33, 0u); GpioGet(P00); GpioInitOut(P34, 0u); GpioPut(P34, 1u); }
/** ****************************************************************************** ** \brief Main function of PDL ** ** \return uint32_t return value, if needed ******************************************************************************/ int32_t main(void) { uint32_t i; for(i=0; i<2048; i++) { au8WrData[i] = 0x12^i; } for(i=0; i<64; i++) { au8WrSpare[i] = 0x55^i; } for(i=0; i<2112; i++) { au8WrData[i] = 0x98^i; } #if (PDL_MCU_CORE == PDL_FM4_CORE) // Reset External Bus for clean start. Clk_PeripheralClockDisable(ClkGateExtif); Clk_PeripheralSetReset(ClkResetExtif); Clk_PeripheralClearReset(ClkResetExtif); Clk_PeripheralClockEnable(ClkGateExtif); #endif // Initialize Nand Flash IO // Data bus SetPinFunc_MADATA00_0(); SetPinFunc_MADATA01_0(); SetPinFunc_MADATA02_0(); SetPinFunc_MADATA03_0(); SetPinFunc_MADATA04_0(); SetPinFunc_MADATA05_0(); SetPinFunc_MADATA06_0(); SetPinFunc_MADATA07_0(); // Control bus SetPinFunc_MNREX_0(); #if (PDL_MCU_TYPE == PDL_FM4_TYPE0) // SK-U120-9B560-MEM SetPinFunc_MCSX0_0(); #else // SK-FM4-144L-S6E2GM SetPinFunc_MCSX2_0(); #endif SetPinFunc_MNCLE_0(); SetPinFunc_MNALE_0(); SetPinFunc_MNWEX_0(); #if (PDL_MCU_TYPE == PDL_FM4_TYPE0) // SK-U120-9B560-MEM if (Ok != S34ml01g_Init(0u, 0x60000000u)) { while(1); } #else // SK-FM4-144L-S6E2GM Gpio1pin_InitOut(GPIO1PIN_P16, Gpio1pin_InitVal(1u)); // Switch to SxB for ADG734 to connect with Nand Flash pins if (Ok != S34ml01g_Init(2u, 0x62000000u)) { while(1); } #endif // Read ID if(Ok != S34ml01g_ReadID(u8Id, 4)) { while(1); } PageReadWriteTest(); PageSpareReadWriteTest(); FlashReadWriteTest(); while(1) {} }
/*! ****************************************************************************** ** \brief Initialize the IO (P61) to be tested ** ** \param none ** ** \return none ****************************************************************************** */ void IoInit(void) { Gpio1pin_InitOut(GPIO1PIN_P61, Gpio1pin_InitVal(1u)); return; }