"FR_INT_ERR" error with Atmega32 and SD card

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello every body

 

I have this code for SD card with Atmega32

 

/*****************************************************
This program was produced by the
CodeWizardAVR V2.05.0 Professional
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com

Project :
Version :
Date    : 5/16/2017
Author  : NeVaDa
Company :
Comments:

Chip type               : ATmega32
Program type            : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model            : Small
External RAM size       : 0
Data Stack size         : 512
*****************************************************/

#include <mega32.h>
#include <delay.h>

// Alphanumeric LCD Module functions
#include <alcd.h>

#ifndef RXB8
#define RXB8 1
#endif

#ifndef TXB8
#define TXB8 0
#endif

#ifndef UPE
#define UPE 2
#endif

#ifndef DOR
#define DOR 3
#endif

#ifndef FE
#define FE 4
#endif

#ifndef UDRE
#define UDRE 5
#endif

#ifndef RXC
#define RXC 7
#endif

#define FRAMING_ERROR (1<<FE)
#define PARITY_ERROR (1<<UPE)
#define DATA_OVERRUN (1<<DOR)
#define DATA_REGISTER_EMPTY (1<<UDRE)
#define RX_COMPLETE (1<<RXC)

// USART Receiver buffer
#define RX_BUFFER_SIZE 8
char rx_buffer[RX_BUFFER_SIZE];

#if RX_BUFFER_SIZE <= 256
unsigned char rx_wr_index,rx_rd_index,rx_counter;
#else
unsigned int rx_wr_index,rx_rd_index,rx_counter;
#endif

// This flag is set on USART Receiver buffer overflow
bit rx_buffer_overflow;

// USART Receiver interrupt service routine
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
   {
   rx_buffer[rx_wr_index++]=data;
#if RX_BUFFER_SIZE == 256
   // special case for receiver buffer size=256
   if (++rx_counter == 0)
      {
#else
   if (rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
   if (++rx_counter == RX_BUFFER_SIZE)
      {
      rx_counter=0;
#endif
      rx_buffer_overflow=1;
      }
   }
}

#ifndef _DEBUG_TERMINAL_IO_
// Get a character from the USART Receiver buffer
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index++];
#if RX_BUFFER_SIZE != 256
if (rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#endif
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
#pragma used-
#endif

// USART Transmitter buffer
#define TX_BUFFER_SIZE 8
char tx_buffer[TX_BUFFER_SIZE];

#if TX_BUFFER_SIZE <= 256
unsigned char tx_wr_index,tx_rd_index,tx_counter;
#else
unsigned int tx_wr_index,tx_rd_index,tx_counter;
#endif

// USART Transmitter interrupt service routine
interrupt [USART_TXC] void usart_tx_isr(void)
{
if (tx_counter)
   {
   --tx_counter;
   UDR=tx_buffer[tx_rd_index++];
#if TX_BUFFER_SIZE != 256
   if (tx_rd_index == TX_BUFFER_SIZE) tx_rd_index=0;
#endif
   }
}

#ifndef _DEBUG_TERMINAL_IO_
// Write a character to the USART Transmitter buffer
#define _ALTERNATE_PUTCHAR_
#pragma used+
void putchar(char c)
{
while (tx_counter == TX_BUFFER_SIZE);
#asm("cli")
if (tx_counter || ((UCSRA & DATA_REGISTER_EMPTY)==0))
   {
   tx_buffer[tx_wr_index++]=c;
#if TX_BUFFER_SIZE != 256
   if (tx_wr_index == TX_BUFFER_SIZE) tx_wr_index=0;
#endif
   ++tx_counter;
   }
else
   UDR=c;
#asm("sei")
}
#pragma used-
#endif

// Standard Input/Output functions
#include <stdio.h>
// Declare your global variables here
// Declare your global variables here
//===============================================
  /* FAT function result */
FRESULT res;
/* number of bytes written/read to the file */
unsigned int nbytes;
/* will hold the information for logical drive 0: */
FATFS fat1;
/* will hold the file information */
FIL file;
/* will hold file attributes, time stamp information */
FILINFO finfo;
/* file path */
char path[]="0:/file2.txt";
/* text to be written to the file */
char text[]="I like CodeVisionAVR!";
/* file read buffer */
char buffer[256];

int i=0;

unsigned char status;

//--------------------------------------------------
/* error message list */
flash char * flash error_msg[]=
{
"", /* not used */
"FR_DISK_ERR",
"FR_INT_ERR",
"FR_INT_ERR",
"FR_NOT_READY",
"FR_NO_FILE",
"FR_NO_PATH",
"FR_INVALID_NAME",
"FR_DENIED",
"FR_EXIST",
"FR_INVALID_OBJECT",
"FR_WRITE_PROTECTED",
"FR_INVALID_DRIVE",
"FR_NOT_ENABLED",
"FR_NO_FILESYSTEM",
"FR_MKFS_ABORTED",
"FR_TIMEOUT"
};
//------------------------------------------------------
/* display error message and stop */
void error(FRESULT res)
{
if ((res>=FR_DISK_ERR) && (res<=FR_TIMEOUT))
   printf("ERROR: %p\r\n",error_msg[res]);
/* stop here */
while(1);
}
//--------------------------------------------------------------
/* display file's attribute, size and time stamp */
void display_status(char *file_name)
{
if ((res=f_stat(file_name,&finfo))==FR_OK)
   printf("File: %s, Attributes: %c%c%c%c%c\r\n"
          "Date: %02u/%02u/%u, Time: %02u:%02u:%02u\r\n"
          "Size: %lu bytes\r\n",
          finfo.fname,
          (finfo.fattrib & AM_DIR) ? 'D' : '-',
          (finfo.fattrib & AM_RDO) ? 'R' : '-',
          (finfo.fattrib & AM_HID) ? 'H' : '-',
          (finfo.fattrib & AM_SYS) ? 'S' : '-',
          (finfo.fattrib & AM_ARC) ? 'A' : '-',
          finfo.fdate & 0x1F, (finfo.fdate >> 5) & 0xF,
          (finfo.fdate >> 9) + 1980,
          (finfo.ftime >> 11), (finfo.ftime >> 5) & 0x3F,
          (finfo.ftime & 0xF) << 1,
          finfo.fsize);
else
   /* an error occured, display it and stop */
   error(res);
}

//================================================

// Timer 0 output compare interrupt service routine
interrupt [TIM0_COMP] void timer0_comp_isr(void)
{
// Place your code here
// Place your code here
 
disk_timerproc();

}

// SPI functions
#include <spi.h>

 

void main(void)
{
// Declare your local variables here

// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;

// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=P State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x40;
DDRB=0x00;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 7.813 kHz
// Mode: CTC top=OCR0
// OC0 output: Disconnected
TCCR0=0x0D;
TCNT0=0x00;
OCR0=0x50;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x02;

// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 9600
UCSRA=0x00;
UCSRB=0xD8;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x33;

// SPI initialization
// SPI Type: Master
// SPI Clock Rate: 2000.000 kHz
// SPI Clock Phase: Cycle Start
// SPI Clock Polarity: Low
// SPI Data Order: MSB First
SPCR=0x50;
SPSR=0x00;

MCUCSR = (1<<JTD);
MCUCSR = (1<<JTD);

// Alphanumeric LCD initialization
// Connections specified in the
// Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu:
// RS - PORTC Bit 0
// RD - PORTC Bit 1
// EN - PORTC Bit 2
// D4 - PORTC Bit 4
// D5 - PORTC Bit 5
// D6 - PORTC Bit 6
// D7 - PORTC Bit 7
// Characters/line: 16
lcd_init(16);

// Global enable interrupts
#asm("sei")

 

 

// mount logical drive 0:
if ((res=f_mount(0,&fat1))==FR_OK){
   printf("result of mounting = %d \r\n",res);
   printf("Logical drive 0: mounted OK\r\n");
   lcd_puts("mount Ok");
   delay_ms(1000);
   lcd_clear();
   }
else
   /* an error occured, display it and stop */
   error(res);

 

 

if ((res=f_open(&file,path,FA_CREATE_ALWAYS | FA_WRITE))==FR_OK)
   {printf("File %s created OK\r\n",path);
   lcd_puts("open Ok");
   delay_ms(1000);
   lcd_clear();}
else
   // an error occured, display it and stop
   error(res);

 

 

/* close the file */
if ((res=f_close(&file))==FR_OK)
   printf("File %s closed OK\r\n",path);
else
   /* an error occured, display it and stop */
   error(res);

 

 

 

 

the result of this code was " "FR_INT_ERR"

 

 

 

please any help..

 

Last Edited: Wed. May 17, 2017 - 06:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

How to properly post source code: http://www.avrfreaks.net/comment...

 

 

JAD89 wrote:
the result of this code was " "FR_INT_ERR"

So have you looked-up the meaning of that error?

 

Have you considered what might be causing it?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes of course I see it, and it means that I have "Assertion failed".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is the error from the mount(), the open() or the close()?

 

What I do when faced with something like this is examine the source of one of those in ff.c and see what code paths lead to FR_INT_ERR or whatever it is.

 

Now I know you mentioned CodeVision and I may keep the ff.c "hidden" but you can pull a separate copy and study that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

firstly I formatted my SD card as Fat32

then I create file and called it "file2.txt"

 

after that I wrote this code:

 

////// My variables////

FRESULT res;
/* number of bytes written/read to the file */
unsigned int nbytes;
/* will hold the information for logical drive 0: */
FATFS fat;
/* will hold the file information */
FIL file;
/* will hold file attributes, time stamp information */
FILINFO finfo;
/* file path */
char path[]="0:/file2.txt";
/* text to be written to the file */
char text[]="I like CodeVisionAVR!";
/* file read buffer */
char buffer[256];

 

 

 

 

 

void main()

{

 

f ((res=f_mount(0,&fat))==FR_OK){
   printf("result of mounting = %d \r\n",res);
   printf("Logical drive 0: mounted OK\r\n");
   }
else
   /* an error occured, display it and stop */
   error(res);

//-----------------------------------------

if ((res=f_open(&file,path,FA_OPEN_ALWAYS | FA_WRITE))==FR_OK)
   printf("File %s created OK\r\n",path);
else

   error(res);
 

 

 

 

if ((res=f_write(&file,text,sizeof(text)-1,&nbytes))==FR_OK)
   printf("%u bytes written of %u\r\n",nbytes,sizeof(text)-1);
else

   error(res);

if ((res=f_close(&file))==FR_OK)
   printf("File %s closed OK\r\n",path);
else

   error(res);
 

}

 

 

 

 

 

 

and I have this Error (FR_INT_ERR) which means that I have "Assertion failed"

Last Edited: Wed. May 17, 2017 - 09:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

How to properly post source code: http://www.avrfreaks.net/comment...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you really think people ask questions like:

clawson wrote:
Is the error from the mount(), the open() or the close()?

for no reason? If you aren't going to answer questions you are asked then I doubt anyone is going to offer help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sorry clawson,,, I forget to mention where I have that Error,,,,,

I have the message error after f_open

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK so I went here...

 

http://elm-chan.org/fsw/ff/00ind...

 

and downloaded the FatFs R0.12c link that contains ff.c and ff.h. This might be a slightly different version to what you are using but within that the f_open looks like this:

FRESULT f_open (
	FIL* fp,			/* Pointer to the blank file object */
	const TCHAR* path,	/* Pointer to the file name */
	BYTE mode			/* Access mode and file open mode flags */
)
{
	FRESULT res;
	DIR dj;
	FATFS *fs;
#if !_FS_READONLY
	DWORD dw, cl, bcs, clst, sc;
	FSIZE_t ofs;
#endif
	DEF_NAMBUF


	if (!fp) return FR_INVALID_OBJECT;

	/* Get logical drive */
	mode &= _FS_READONLY ? FA_READ : FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_CREATE_NEW | FA_OPEN_ALWAYS | FA_OPEN_APPEND | FA_SEEKEND;
	res = find_volume(&path, &fs, mode);
	if (res == FR_OK) {
		dj.obj.fs = fs;
		INIT_NAMBUF(fs);
		res = follow_path(&dj, path);	/* Follow the file path */
#if !_FS_READONLY	/* R/W configuration */
		if (res == FR_OK) {
			if (dj.fn[NSFLAG] & NS_NONAME) {	/* Origin directory itself? */
				res = FR_INVALID_NAME;
			}
#if _FS_LOCK != 0
			else {
				res = chk_lock(&dj, (mode & ~FA_READ) ? 1 : 0);
			}
#endif
		}
		/* Create or Open a file */
		if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) {
			if (res != FR_OK) {					/* No file, create new */
				if (res == FR_NO_FILE) {		/* There is no file to open, create a new entry */
#if _FS_LOCK != 0
					res = enq_lock() ? dir_register(&dj) : FR_TOO_MANY_OPEN_FILES;
#else
					res = dir_register(&dj);
#endif
				}
				mode |= FA_CREATE_ALWAYS;		/* File is created */
			}
			else {								/* Any object is already existing */
				if (dj.obj.attr & (AM_RDO | AM_DIR)) {	/* Cannot overwrite it (R/O or DIR) */
					res = FR_DENIED;
				} else {
					if (mode & FA_CREATE_NEW) res = FR_EXIST;	/* Cannot create as new file */
				}
			}
			if (res == FR_OK && (mode & FA_CREATE_ALWAYS)) {	/* Truncate it if overwrite mode */
				dw = GET_FATTIME();
#if _FS_EXFAT
				if (fs->fs_type == FS_EXFAT) {
					/* Get current allocation info */
					fp->obj.fs = fs;
					fp->obj.sclust = ld_dword(fs->dirbuf + XDIR_FstClus);
					fp->obj.objsize = ld_qword(fs->dirbuf + XDIR_FileSize);
					fp->obj.stat = fs->dirbuf[XDIR_GenFlags] & 2;
					fp->obj.n_frag = 0;
					/* Initialize directory entry block */
					st_dword(fs->dirbuf + XDIR_CrtTime, dw);	/* Set created time */
					fs->dirbuf[XDIR_CrtTime10] = 0;
					st_dword(fs->dirbuf + XDIR_ModTime, dw);	/* Set modified time */
					fs->dirbuf[XDIR_ModTime10] = 0;
					fs->dirbuf[XDIR_Attr] = AM_ARC;				/* Reset attribute */
					st_dword(fs->dirbuf + XDIR_FstClus, 0);		/* Reset file allocation info */
					st_qword(fs->dirbuf + XDIR_FileSize, 0);
					st_qword(fs->dirbuf + XDIR_ValidFileSize, 0);
					fs->dirbuf[XDIR_GenFlags] = 1;
					res = store_xdir(&dj);
					if (res == FR_OK && fp->obj.sclust) {		/* Remove the cluster chain if exist */
						res = remove_chain(&fp->obj, fp->obj.sclust, 0);
						fs->last_clst = fp->obj.sclust - 1;		/* Reuse the cluster hole */
					}
				} else
#endif
				{
					/* Clean directory info */
					st_dword(dj.dir + DIR_CrtTime, dw);	/* Set created time */
					st_dword(dj.dir + DIR_ModTime, dw);	/* Set modified time */
					dj.dir[DIR_Attr] = AM_ARC;			/* Reset attribute */
					cl = ld_clust(fs, dj.dir);			/* Get cluster chain */
					st_clust(fs, dj.dir, 0);			/* Reset file allocation info */
					st_dword(dj.dir + DIR_FileSize, 0);
					fs->wflag = 1;

					if (cl) {							/* Remove the cluster chain if exist */
						dw = fs->winsect;
						res = remove_chain(&dj.obj, cl, 0);
						if (res == FR_OK) {
							res = move_window(fs, dw);
							fs->last_clst = cl - 1;		/* Reuse the cluster hole */
						}
					}
				}
			}
		}
		else {	/* Open an existing file */
			if (res == FR_OK) {					/* Following succeeded */
				if (dj.obj.attr & AM_DIR) {		/* It is a directory */
					res = FR_NO_FILE;
				} else {
					if ((mode & FA_WRITE) && (dj.obj.attr & AM_RDO)) { /* R/O violation */
						res = FR_DENIED;
					}
				}
			}
		}
		if (res == FR_OK) {
			if (mode & FA_CREATE_ALWAYS)		/* Set file change flag if created or overwritten */
				mode |= FA_MODIFIED;
			fp->dir_sect = fs->winsect;			/* Pointer to the directory entry */
			fp->dir_ptr = dj.dir;
#if _FS_LOCK != 0
			fp->obj.lockid = inc_lock(&dj, (mode & ~FA_READ) ? 1 : 0);
			if (!fp->obj.lockid) res = FR_INT_ERR;
#endif
		}
#else		/* R/O configuration */
		if (res == FR_OK) {
			if (dj.fn[NSFLAG] & NS_NONAME) {	/* Origin directory itself? */
				res = FR_INVALID_NAME;
			} else {
				if (dj.obj.attr & AM_DIR) {		/* It is a directory */
					res = FR_NO_FILE;
				}
			}
		}
#endif

		if (res == FR_OK) {
#if _FS_EXFAT
			if (fs->fs_type == FS_EXFAT) {
				fp->obj.c_scl = dj.obj.sclust;							/* Get containing directory info */
				fp->obj.c_size = ((DWORD)dj.obj.objsize & 0xFFFFFF00) | dj.obj.stat;
				fp->obj.c_ofs = dj.blk_ofs;
				fp->obj.sclust = ld_dword(fs->dirbuf + XDIR_FstClus);	/* Get object allocation info */
				fp->obj.objsize = ld_qword(fs->dirbuf + XDIR_FileSize);
				fp->obj.stat = fs->dirbuf[XDIR_GenFlags] & 2;
			} else
#endif
			{
				fp->obj.sclust = ld_clust(fs, dj.dir);					/* Get object allocation info */
				fp->obj.objsize = ld_dword(dj.dir + DIR_FileSize);
			}
#if _USE_FASTSEEK
			fp->cltbl = 0;			/* Disable fast seek mode */
#endif
			fp->obj.fs = fs;	 	/* Validate the file object */
			fp->obj.id = fs->id;
			fp->flag = mode;		/* Set file access mode */
			fp->err = 0;			/* Clear error flag */
			fp->sect = 0;			/* Invalidate current data sector */
			fp->fptr = 0;			/* Set file pointer top of the file */
#if !_FS_READONLY
#if !_FS_TINY
			mem_set(fp->buf, 0, _MAX_SS);	/* Clear sector buffer */
#endif
			if ((mode & FA_SEEKEND) && fp->obj.objsize > 0) {	/* Seek to end of file if FA_OPEN_APPEND is specified */
				fp->fptr = fp->obj.objsize;			/* Offset to seek */
				bcs = (DWORD)fs->csize * SS(fs);	/* Cluster size in byte */
				clst = fp->obj.sclust;				/* Follow the cluster chain */
				for (ofs = fp->obj.objsize; res == FR_OK && ofs > bcs; ofs -= bcs) {
					clst = get_fat(&fp->obj, clst);
					if (clst <= 1) res = FR_INT_ERR;
					if (clst == 0xFFFFFFFF) res = FR_DISK_ERR;
				}
				fp->clust = clst;
				if (res == FR_OK && ofs % SS(fs)) {	/* Fill sector buffer if not on the sector boundary */
					if ((sc = clust2sect(fs, clst)) == 0) {
						res = FR_INT_ERR;
					} else {
						fp->sect = sc + (DWORD)(ofs / SS(fs));
#if !_FS_TINY
						if (disk_read(fs->drv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR;
#endif
					}
				}
			}
#endif
		}

		FREE_NAMBUF();
	}

	if (res != FR_OK) fp->obj.fs = 0;	/* Invalidate file object on error */

	LEAVE_FF(fs, res);
}

I have marked in RED the places where that may return FR_INT_ERR. There's quite a strong chance it is one of those code paths/reasons why you have the error. So I'd investigate each in turn.

Of course it may be that this function calls other function which in turn give an FR_INT_ERR return. It's up to you to explore each and see it it could be the reason for the problem you see.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

THANK YOU clawson for your response

 

 

1. Now I have this Error at f_close ;

 

"FR_DISK_ERR"

 

2. secondly I would ask you Why does my program only work  at the first time I program the MCU and and the programmer is connected???,,,,so after I disconnected the power and connected it,, the programme it doesn't work!!!????

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JAD89 wrote:
Why does my program only work  at the first time I program the MCU and and the programmer is connected?

2 common reasons are

 

  1. You have a grounding issue which is "fixed" when the debugger is connected & provides a good ground;
  2. You have a reset issue which is "fixed" when the debugger is connected & provides a good reset.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

... and just to elaborate a little... a good reset means... tying the reset pin up to the Vcc via a 10K resistor. Without this connection, the reset pin will be floating with an undefined state.

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:
Without this connection, the reset pin will be floating with an undefined state.  

Not true.  Indeed a reset "circuit" with at least a pullup and usually a cap and sometimes diode is on all of our AVR8 production apps, and recommended for robust operation in a variety of environments, an AVR8 /RESET has a weak internal pullup.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arhh... of course you are correct Lee. Figure 15 of the Atmega32 datasheet ( 2503N–AVR–06/08 ) clearly shows an internal pullup resistor.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanx For Your answers

 

 

But now I have this problem:

 

I need to get the size of file, and I wrote:

 

 

 res = f_stat("JAD11.txt", &finfo);
    printf("Size: %lu\n\r", finfo.fsize);

 

but I always have this result:

size: 0

 

 

could you please help me

 

Last Edited: Sun. May 21, 2017 - 11:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So what do you get with f_size()?