SDIO_FATFS_MDK debug log

Publisher:q13358975046Latest update time:2016-10-06 Source: eefocusKeywords:SDIO Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Now it has been adjusted and all operations of the file system have been basically tested, and the code still needs to be sorted out.

 


First of all, I want to talk about a problem, which is the problem of jumping hardware interrupts when writing files (f_write). The stack is not enough. The development board used is Struggle v3.0, the chip is stm32f103vet6, and there is 64K RAM, but the definition of the stack in the startup code file startup_stm32f10x_hd.s is very small. I don’t know why. Is it because other hardware resources are allocated by themselves? I haven’t figured it out yet. The following picture is for proof:

SDIO_FATFS_MDK Debug Record - Beans - Code Beans
 
It was originally 512 bytes, but I changed it to 2048 bytes (2kb). It can be used now. During the Fatfs operation, each write operation unit is 512 bytes, and the stack is also 512 bytes, so it will overflow naturally, and then the program will jump to the hardware interrupt to rest.

Another problem is that the program will die on the SD card write operation. Now the reason has been found. It is necessary to look carefully at the direct access of DMA and SDIO.

SDIO_FATFS_MDK Debug Record - Beans - Code Beans
 
Comment it out and you can write the file normally.

January 12, 2011 11:40:54
Here is my understanding and solution:
First of all, we analyzed the code and found that it was not the following read operation but the f_close() function of the write operation that caused the program to loop in the above place.
At the beginning of the sdcard.c file, volatile SD_Error TransferError = SD_OK; (ie 0x2A) is defined
So let's analyze what this sentence means.
    while ((TransferEnd == 0) && (TransferError == SD_OK))
    {}
When the transfer is complete and there are no errors, it enters an infinite loop?! It doesn't make sense, but it works in the IAR compiler. Now we need to find out if there is any operation from the definition to the infinite loop that can change the values ​​of these two variables. At first glance, there is no change, so we need to compare it with the IAR simulation run.

The problem has been solved, thanks to netizen stm32!
To add the SDIO interrupt service function in stm32f10x_it.c,
/*******************************************************************************
* Function Name  : SDIO_IRQHandler
* Description    : This function handles SDIO global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SDIO_IRQHandler(void)
{
   SD_ProcessIRQSrc();
}
Then it's ok.
Keywords:SDIO Reference address:SDIO_FATFS_MDK debug log

Previous article:STM32_Touch Summary
Next article:STM32 EXTI

Recommended ReadingLatest update time:2024-11-16 14:41

Solution to "could not stop cortex-m device" when debugging STM32 in MDK
Error as http://www.amobbs.com/forum.php?mod=viewthread&tid=4075329 The error picture is as follows:   My solution: It was found that RESET was always around 1V. After replacing the pull-down capacitor at RESET, the first error disappeared, but the following error popped up: No Cortex-M Device found in JTA
[Microcontroller]
Solution to
Keil (MDK-ARM) Series Tutorial (VIII)_Online Debugging (I)
Ⅰ. Write in front There are many contents in Keil online debugging. This article brings the commonly used contents in online debugging: detailed contents of shortcut buttons in Debug Toolbar (reset, full speed run, stop running, single step debugging, line by line debugging, jump out of debugging, run to cursor line,
[Microcontroller]
Keil (MDK-ARM) Series Tutorial (VIII)_Online Debugging (I)
S3C2440 MMU driver code template (RealView MDK)
A good memory is not as good as a bad pen. In order to facilitate the code review and code reuse in the future, here is the S3C2440 MMU code library I wrote. I used the friendly MINI2440 development board and the development environment was RealView MDK 4.22. The source code structure is simple and clear. The original
[Microcontroller]
S3C2440 MMU operation (MDK4.22)
About MMU knowledge: 1. The address translation process on the ARM CPU involves three concepts: virtual address VA, translation address MVA, and physical address PA. When the MMU is not started, the CPU core, cache, and MMU all see PA. After starting the MMU, the CPU core sends out VA, which is converted into MVA an
[Microcontroller]
S3C2440 MMU operation (MDK4.22)
Mini2440 is used to migrate the ADS project to Keil MDK step by step
It has been two months since I bought the board. At first, I wanted to run it naked, but the projects were all under ADS, which couldn't be used on the win7 system. So I thought about running it on MDK, but the startup file of s3c2440 on MDK is incomplete, so it is not recommended to use. I talked about it for a long
[Microcontroller]
Research on CAN Bus Simulation Based on RealView MDK
0 Introduction RealView MDK is a product of ARM, which has been verified and used by more than 100,000 embedded development engineers worldwide. It is the latest software development tool launched by ARM for various embedded processors. RealView MDK integrates the most advanced technologies in the industry,
[Industrial Control]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号