TI中文支持网
TI专业的中文技术问题搜集分享网站

C6748 SPI flash 烧录引导程序的问题。

ti的工程师:
我用的是一个6748的DSP,为了节约成本用w25q32取代之前的32M nandflash。采用的模板是
OMAP-L138_FlashAndBootUtils_2_40.tar.gz,  用的模这个压缩包里面的spiflash write的工程,工程编译成功后进行烧写的实验。
实验过程:运行后读取完烧录的文件后,就会一直卡在发送擦除命令的步骤,因为返回的抑制是0xFF没有成功,我单独写入了读取ID的命令返回也是0xFF。
首先检查了硬件部分,CLK、DO、DI都正确连接。WP(写保护置高没有起作用)
我按照wiki的指导,修改了下面这些地方。
  • DDR Configuration
    • OMAP-L138/Common/src/device.c: Modify the parameters passed to the function DEVICE_ExternalMemInit to match the DDR timing requirements for the custom board
    • 1.我们用的是24.576M晶振,倍频以后CPU是442MHz,DDR是159MHz。这里参数做了修改
  • UART Settings
    • OMAP-L138/Common/include/device_uart.h: Modify the #define DEVICE_UART_PERIPHNUM to set which UART is connected to the host PC.
    • Note that flow control is not used, so only the RX and TX lines need to be connected for boot and flashing purposes.
    • 2.串口部分没有做任何的修改
  • SPI Settings
    • OMAP-L138/Common/include/device_spi.h: Modify the global macros to select the appropriate peripheral and chip select numbers.
    • 3.我们使用了SPI0接口和片选cs0
    • OMAP-L138/Common/src/device_spi.c: Modify the flash organization in DEVICE_SPI_MEM_params.
    • 4.按照w25q64的sector和bulk size做了相应的修改。
    • The SPI flash on the EVM does not need to be unlocked in order to erase or write. Some SPI flashes may need to set the BL bits before writing. Check the device datasheet to see if this step needs to be added to the initialization.
  • NAND Settings
    • OMAP-L138/Common/include/device_async_mem.h: Modify the #define DEVICE_ASYNC_MEM_NANDBOOT_BUSWIDTH to match the bus width of your NAND
    • 5.没有涉及到nandflash,所以没有变。
  • PLL Settings (for non 24 MHz input clocks)
  • OMAP-L138/Common/src/device.c: Modify the parameters passed into the function DEVICE_PLL0Init and DEVICE_PLL1Init to set the proper PLL output frequencies
  • PLL0和PLL1的初始化按照24.576MHz进行了倍频。
  • OMAP-L138/Common/src/device_uart.c: Modify the 'divider' field in DEVICE_UART_config to achieve 115200 baud rate
  • 波特率也做了相应的修改

所以检查了整个流程没有发现遗漏的地方,现在有些没有头绪。我用逻辑分析仪观察写入的过程发现我们片选信号拉低是工作,但是这个拉低的时间很短,逻辑分析仪上看只有几个时钟就拉高了,感觉没有有效的写入一个命令。

Tony Tang:

你能测量SPI_CS,那测一下SPI_CLK看是一个CS对应了几个clock.

taoyu:

回复 Tony Tang:

唐工我发个图吧,最上面是cs片选,第二条线是spi输出,第三条是时钟,最后是spi输入。图上可以看出来片选信号就起作用了1个时钟就拉高了。但是我看了代码。片选都是成对出现的,而且官方的代码应该没有什么大的问题。

// Issue write enable command
SPI_enableCS(hSPIMemInfo->hSPIInfo);SPI_xferOneChar(hSPIMemInfo->hSPIInfo,SPI_MEM_CMD_WREN);
SPI_disableCS(hSPIMemInfo->hSPIInfo);// Poll EEPROM Status to make sure Write Enable Latch has been setdo{// Send Read Status Register CommeandSPI_enableCS(hSPIMemInfo->hSPIInfo);SPI_xferOneChar(hSPIMemInfo->hSPIInfo,SPI_MEM_CMD_RDSR);statusReg = SPI_xferOneChar(hSPIMemInfo->hSPIInfo,0x00);
SPI_disableCS(hSPIMemInfo->hSPIInfo);}

taoyu:

回复 Tony Tang:

唐工我发个图吧,最上面是cs片选,第二条线是spi输出,第三条是时钟,最后是spi输入。图上可以看出来片选信号就起作用了1个时钟就拉高了。但是我看了代码。片选都是成对出现的,而且官方的代码应该没有什么大的问题。

// Issue write enable commandSPI_enableCS(hSPIMemInfo->hSPIInfo);SPI_xferOneChar(hSPIMemInfo->hSPIInfo,SPI_MEM_CMD_WREN);SPI_disableCS(hSPIMemInfo->hSPIInfo);// Poll EEPROM Status to make sure Write Enable Latch has been setdo{// Send Read Status Register CommeandSPI_enableCS(hSPIMemInfo->hSPIInfo);SPI_xferOneChar(hSPIMemInfo->hSPIInfo,SPI_MEM_CMD_RDSR);statusReg = SPI_xferOneChar(hSPIMemInfo->hSPIInfo,0x00);SPI_disableCS(hSPIMemInfo->hSPIInfo);}

赞(0)
未经允许不得转载:TI中文支持网 » C6748 SPI flash 烧录引导程序的问题。
分享到: 更多 (0)