本帖最后由 yonggo 于 2024-3-19 21:11 编辑
管理員好,各位神人好,想請問一下
我透過新唐提供的https://github.com/OpenNuvoton/MA35D1_RTP_BSP,
裡面的MA35D1_RTP_BSP/SampleCode/StdDriver/SPI_Flash,
我的開發版是MA35D16F987C,Flash為winbond的W25N02ZEIR
步驟如下:
1. 將這個源碼用NuEclipse編譯出SPI_Flash.elf
2. 放置到MA35D1的/usr/fw這個資料夾(自己建立的)
3. # echo -n /usr/fw > /sys/module/firmware_class/parameters/path
4. # echo -n SPI_Flash.elf > /sys/class/remoteproc/remoteproc0/firmware
5. # echo start > /sys/class/remoteproc/remoteproc0/state
6. 利用UART16 print 出結果
-----------------------------------------------------------------------------------------------
問題1: 在 uint16_t SpiFlash_ReadMidDid(void) 函數卡住(如圖片)
並沒有跳到if判斷的結果:
if((u16ID = SpiFlash_ReadMidDid()) != 0xEF14)
{
printf("Wrong ID, 0x%x\n", u16ID);
while(1);
}
else
printf("Flash found: W25X16 ...\n");
-----------------------------------------------------------------------------------------------
問題2: 想更改SYS_Init函數中的XT1_OUT與XT1_IN串口設置
void SYS_Init(void)
{
/* Set XT1_OUT(PF.2) and XT1_IN(PF.3) to input mode */
PF->MODE &= ~(GPIO_MODE_MODE2_Msk | GPIO_MODE_MODE3_Msk);
...
}
但手冊中XT1_OUT及XT1_IN並不在MA35D16F987的PF.2和PF.3,想請問如何設定?
-----------------------------------------------------------------------------------------------
註:有更改UART16及SPI0串口設置
void SYS_Init(void){
...
/* Set GPE multi-function pins for UART0 RXD and TXD */ SYS->GPD_MFPH &= ~(SYS_GPD_MFPH_PD10MFP_Msk | SYS_GPD_MFPH_PD11MFP_Msk);
SYS->GPD_MFPH |= SYS_GPD_MFPH_PD10MFP_UART16_RXD | SYS_GPD_MFPH_PD11MFP_UART16_TXD;
/* Setup SPI0 multi-function pins */
/* GP G */
SYS->GPG_MFPL &= ~(SYS_GPG_MFPL_PG0MFP_Msk);
SYS->GPG_MFPL |= SYS_GPG_MFPL_PG0MFP_SPI0_SS0;
/* GP B */
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB9MFP_Msk);
SYS->GPB_MFPH |= SYS_GPB_MFPH_PB9MFP_SPI0_CLK;
/* GP L */
SYS->GPL_MFPH &= ~(SYS_GPL_MFPH_PL14MFP_Msk | SYS_GPL_MFPH_PL15MFP_Msk);
SYS->GPL_MFPH |= SYS_GPL_MFPH_PL14MFP_SPI0_MOSI | SYS_GPL_MFPH_PL15MFP_SPI0_MISO;
}
圖片結果:
|
|