1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
guigui_7044 发表于 2018-8-15 08:16 您好,请问我对例程里的显示部分做了如下注释是否有影响,如果没有影响,为何我在串口输入ls命令为何总是返回Command returned error code FR_NOT_READY,是我硬件连接的问题吗?我是按照spi接线接的。麻烦解答一下,谢谢。intmain(void)[ int nStatus; FRESULT iFResult;// tRectangle sRect; // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // ROM_FPULazyStackingEnable(); // // Set the system clock to run at 50MHz from the PLL. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable the peripherals used by this example. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); // // Configure SysTick for a 100Hz interrupt. The FatFs driver wants a 10 ms // tick. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100); ROM_SysTickEnable(); ROM_SysTickIntEnable(); // // Enable Interrupts // ROM_IntMasterEnable(); // // Initialize the UART as a console for text I/O. // ConfigureUART(); // // Initialize the display driver. //// CFAL96x64x16Init();//// //// // Initialize the graphics context.// //// GrContextInit(&g_sContext, &g_sCFAL96x64x16);//// //// // Fill the top part of the screen with blue to create the banner.// //// sRect.i16XMin = 0;// sRect.i16YMin = 0;// sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;// sRect.i16YMax = 9;// GrContextForegroundSet(&g_sContext, ClrDarkBlue);// GrRectFill(&g_sContext, &sRect);//// //// // Change foreground for white text.// //// GrContextForegroundSet(&g_sContext, ClrWhite);//// //// // Put the application name in the middle of the banner.// //// GrContextFontSet(&g_sContext, g_psFontFixed6x8);// GrStringDrawCentered(&g_sContext, "sd_card", -1,// GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);//// //// // Show some instructions on the display// //// GrContextFontSet(&g_sContext, g_psFontFixed6x8);// GrStringDrawCentered(&g_sContext, "Connect a", -1,// GrContextDpyWidthGet(&g_sContext) / 2, 20, false);// GrStringDrawCentered(&g_sContext, "terminal", -1,// GrContextDpyWidthGet(&g_sContext) / 2, 30, false);// GrStringDrawCentered(&g_sContext, "to UART0.", -1,// GrContextDpyWidthGet(&g_sContext) / 2, 40, false);// GrStringDrawCentered(&g_sContext, "115000,N,8,1", -1,// GrContextDpyWidthGet(&g_sContext) / 2, 50, false); // // Print hello message to user. // UARTprintf("nnSD Card Example Programn"); UARTprintf("Type 'help' for help.n"); |
|
|
|
|
|
// GPIO for SSI pins #define SDC_GPIO_PORT_BASE GPIO_PORTA_BASE #define SDC_GPIO_SYSCTL_PERIPH SYSCTL_PERIPH_GPIOA #define SDC_SSI_CLK GPIO_PIN_2 #define SDC_SSI_TX GPIO_PIN_5 #define SDC_SSI_RX GPIO_PIN_4 #define SDC_SSI_FSS GPIO_PIN_3 #define SDC_SSI_PINS (SDC_SSI_TX | SDC_SSI_RX | SDC_SSI_CLK | SDC_SSI_FSS) 程序定义是如此,应该跟你定义是一样 |
|
|
|
|
|
guigui_7044 发表于 2018-8-15 09:01 您好,硬件问题解决了,例程也跑通了。但如果我想改变SSI0为SSI3,除了对一下部分修改外,还需对什么地方修改么?还望解答,谢谢。 sd_card.c://// Enable the peripherals used by this example.////ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);-----------------------------------------------------------------------------------mmc-dk-tm4c123g.c:/* Peripheral definitions for DK-TM4C123G board */// SSI port//#define SDC_SSI_BASE SSI0_BASE//#define SDC_SSI_SYSCTL_PERIPH SYSCTL_PERIPH_SSI0// GPIO for SSI pins//#define SDC_GPIO_PORT_BASE GPIO_PORTA_BASE//#define SDC_GPIO_SYSCTL_PERIPH SYSCTL_PERIPH_GPIOA//#define SDC_SSI_CLK GPIO_PIN_2//#define SDC_SSI_TX GPIO_PIN_5//#define SDC_SSI_RX GPIO_PIN_4//#define SDC_SSI_FSS GPIO_PIN_3//#define SDC_SSI_PINS (SDC_SSI_TX | SDC_SSI_RX | SDC_SSI_CLK | SDC_SSI_FSS)/* Peripheral definitions for DK-TM4C123G board */// SSI port#define SDC_SSI_BASE SSI3_BASE#define SDC_SSI_SYSCTL_PERIPH SYSCTL_PERIPH_SSI3// GPIO for SSI pins#define SDC_GPIO_PORT_BASE GPIO_PORTD_BASE#define SDC_GPIO_SYSCTL_PERIPH SYSCTL_PERIPH_GPIOD#define SDC_SSI_CLK GPIO_PIN_0#define SDC_SSI_TX GPIO_PIN_3#define SDC_SSI_RX GPIO_PIN_2#define SDC_SSI_FSS GPIO_PIN_1#define SDC_SSI_PINS (SDC_SSI_TX | SDC_SSI_RX | SDC_SSI_CLK | SDC_SSI_FSS) |
|
|
|
|
|
hljgaoqf 发表于 2018-8-15 09:53 还是我自己来解答吧。想把端口从SSI0挪到SSI3,作如下处理即可: #include "driverlib/pin_map.h"//添加这个头文件#if 0/* Peripheral definitions for DK-TM4C123G board */// SSI port#define SDC_SSI_BASE SSI0_BASE#define SDC_SSI_SYSCTL_PERIPH SYSCTL_PERIPH_SSI0// GPIO for SSI pins#define SDC_GPIO_PORT_BASE GPIO_PORTA_BASE#define SDC_GPIO_SYSCTL_PERIPH SYSCTL_PERIPH_GPIOA#define SDC_SSI_CLK GPIO_PIN_2#define SDC_SSI_TX GPIO_PIN_5#define SDC_SSI_RX GPIO_PIN_4#define SDC_SSI_FSS GPIO_PIN_3#define SDC_SSI_PINS (SDC_SSI_TX | SDC_SSI_RX | SDC_SSI_CLK | SDC_SSI_FSS)#endif#if 1/* Peripheral definitions for DK-TM4C123G board */// SSI port#define SDC_SSI_BASE SSI3_BASE#define SDC_SSI_SYSCTL_PERIPH SYSCTL_PERIPH_SSI3// GPIO for SSI pins#define SDC_GPIO_PORT_BASE GPIO_PORTD_BASE#define SDC_GPIO_SYSCTL_PERIPH SYSCTL_PERIPH_GPIOD#define SDC_SSI_CLK GPIO_PIN_0#define SDC_SSI_TX GPIO_PIN_3#define SDC_SSI_RX GPIO_PIN_2#define SDC_SSI_FSS GPIO_PIN_1#define SDC_SSI_PINS (SDC_SSI_TX | SDC_SSI_RX | SDC_SSI_CLK | SDC_SSI_FSS)#endifstaticvoid power_on (void)[ /* * This doesn't really turn the power on, but initializes the * SSI port and pins needed to talk to the card. */ /* Enable the peripherals used to drive the SDC on SSI */ ROM_SysCtlPeripheralEnable(SDC_SSI_SYSCTL_PERIPH); ROM_SysCtlPeripheralEnable(SDC_GPIO_SYSCTL_PERIPH); /* * Configure the appropriate pins to be SSI instead of GPIO. The FSS (CS) * signal is directly driven to ensure that we can hold it low through a * complete transaction with the SD card. */ ROM_GPIOPinTypeSSI(SDC_GPIO_PORT_BASE, SDC_SSI_TX | SDC_SSI_RX | SDC_SSI_CLK); ROM_GPIOPinTypeGPIOOutput(SDC_GPIO_PORT_BASE, SDC_SSI_FSS); /* * Set the SSI output pins to 4MA drive strength and engage the * pull-up on the receive line. */ MAP_GPIOPadConfigSet(SDC_GPIO_PORT_BASE, SDC_SSI_RX, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU); MAP_GPIOPadConfigSet(SDC_GPIO_PORT_BASE, SDC_SSI_CLK | SDC_SSI_TX | SDC_SSI_FSS, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);#if 1 GPIOPinConfigure(GPIO_PD1_SSI3FSS); GPIOPinConfigure(GPIO_PD2_SSI3RX); GPIOPinConfigure(GPIO_PD0_SSI3CLK); GPIOPinConfigure(GPIO_PD3_SSI3TX);#endif /* Configure the SSI0 port */ ROM_SSIConfigSetExpClk(SDC_SSI_BASE, ROM_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 400000, 8); ROM_SSIEnable(SDC_SSI_BASE); /* Set DI and CS high and apply more than 74 pulses to SCLK for the card */ /* to be able to accept a native command. */ send_initial_clock_train(); PowerFlag = 1;] |
|
|
|
|
|
hljgaoqf 发表于 2018-8-15 10:01 你的代码写的不错,很规范。尤其是代码屏蔽的部分和修改,用#define 和 #end if实现,确实是很巧妙的。值得借鉴一下! |
|
|
|
|
|
只有小组成员才能发言,加入小组>>
336 浏览 1 评论
529 浏览 2 评论
NA555DR VCC最低电压需要在5V供电,为什么用3.3V供电搭了个单稳态触发器也使用正常?
774 浏览 3 评论
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
651 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1130 浏览 1 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
56浏览 29评论
133浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
252浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
201浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
57浏览 13评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 03:23 , Processed in 1.288147 second(s), Total 80, Slave 68 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号