用的是示例代码
一个是六轴传感器的示例代码还有一个是FATFS文件系统
我将这两个工程合并之后 运行之前的代码 发现一直卡在了sd_int 函数中
该添加的文件也都添加了
编译也通过了 但是就是卡住 在原来的程序里是可以运行的
请问是时钟的问题吗 delay文件我看了也是一样的
#include "sys.h"
#include "usart.h"
#include "usmart.h"
#include "delay.h"
#include "led.h"
#include "key.h"
#include "lcd.h"
#include "malloc.h"
#include "w25qxx.h"
#include "sd_card.h"
#include "ff.h"
#include "exfuns.h"
int main(void)
{
u32 total, free;
u8 t = 0;
u8 res = 0;
HAL_Init();
SystemClock_Config();
delay_init(80);
uart_init(115200);
usmart_dev.init(80);
LED_Init();
KEY_Init();
LCD_Init();
W25QXX_Init();
my_mem_init(SRAM1);
my_mem_init(SRAM2);
POINT_COLOR = RED;
Display_ALIENTEK_LOGO(0, 0);
LCD_ShowString(30, 80, 200, 16, 16, "Pandora STM32L4 IOT");
LCD_ShowString(30, 100, 200, 16, 16, "FATFS TEST");
LCD_ShowString(30, 120, 200, 16, 16, "ATOM@ALIENTEK");
LCD_ShowString(30, 140, 200, 16, 16, "2018/10/27");
LCD_ShowString(30, 160, 200, 16, 16, "Use USMART For Test");
while(SD_Init())//¼ì²â²»µ½SD¿¨
{
LCD_ShowString(30, 180, 200, 16, 16, "SD Card Error!");
delay_ms(500);
LCD_ShowString(30, 180, 200, 16, 16, "Please Check! ");
delay_ms(500);
LED_B_TogglePin;
}
exfuns_init();
f_mount(fs[0], "0:", 1);
res = f_mount(fs[1], "1:", 1);
if(res == 0X0D)
{
LCD_ShowString(30, 180, 200, 16, 16, "Flash Disk Formatting...");
res = f_mkfs("1:", 1, 4096);
if(res == 0)
{
f_setlabel((const TCHAR *)"1:ALIENTEK");
LCD_ShowString(30, 180, 200, 16, 16, "Flash Disk Format Finish");
}
else LCD_ShowString(30, 180, 200, 16, 16, "Flash Disk Format Error ");
delay_ms(1000);
}
LCD_Fill(30, 180, 240, 180 + 16, WHITE);
while(exf_getfree((u8 *)"0:", &total, &free))
{
LCD_ShowString(30, 180, 200, 16, 16, "SD Card Fatfs Error!");
delay_ms(200);
LCD_Fill(30, 180, 240, 180 + 16, WHITE);
delay_ms(200);
LED_B_TogglePin;//DS0ÉÁ˸
}
POINT_COLOR = BLUE;
LCD_ShowString(30, 180, 200, 16, 16, "FATFS OK!");
LCD_ShowString(30, 200, 200, 16, 16, "SD Total Size: MB");
LCD_ShowString(30, 220, 200, 16, 16, "SD Free Size: MB");
LCD_ShowNum(30 + 8 * 14, 200, total >> 10, 5, 16);
LCD_ShowNum(30 + 8 * 14, 220, free >> 10, 5, 16);
while(1)
{
t++;
delay_ms(200);
LED_B_TogglePin;//DS0ÉÁ˸
}
}
一周热门 更多>