Surely this was discussed earlier in the thread? Anyway most AVRs don't have an RTC so there's no way to give accurate timestamps to the files that are created. The only function ff.c actually calls is get_fattime() so in your own main.c (or some appropriate .c file) just use:
typedef struct {
WORD year; /* 2000..2099 */
BYTE month; /* 1..12 */
BYTE mday; /* 1.. 31 */
BYTE wday; /* 1..7 */
BYTE hour; /* 0..23 */
BYTE min; /* 0..59 */
BYTE sec; /* 0..59 */
} RTC;
...
/*---------------------------------------------------------*/
/* User Provided Timer Function for FatFs module */
/*---------------------------------------------------------*/
/* This is a real time clock service to be called from */
/* FatFs module. Any valid time must be returned even if */
/* the system does not support a real time clock. */
/* This is not required in read-only configuration. */
/*---------------------------------------------------------*/
/* Dummy time function as no rtc.c */
/*---------------------------------------------------------*/
DWORD get_fattime ()
{
RTC rtc;
/* Get local time */
// rtc_gettime(&rtc);
rtc.year = 2009;
rtc.month = 1;
rtc.mday = 1;
rtc.wday = 1;
rtc.hour = 12;
rtc.min = 0;
rtc.sec = 0;
/* Pack date and time into a DWORD variable */
return ((DWORD)(rtc.year - 1980) << 25)
| ((DWORD)rtc.month << 21)
| ((DWORD)rtc.mday << 16)
| ((DWORD)rtc.hour << 11)
| ((DWORD)rtc.min << 5)
| ((DWORD)rtc.sec >> 1);
}
then remove any other references to "RTC". The above just arranges for all files to have a time stamp of "12:00:00 1/1/2009"
Read again. The function I'm talking about is get_fattime() not rtc_gettime() or rtc_settime(). Just leave rtc.c out of the list of files to build in the makefile and the only "Undefined reference" you'll see is to get_fattime(). So now just provide that dummy function I showed in one of the .c files that IS still being built.
ah, yes, ok. Will do, thank you.
Taking the risk to annoy you, but let's assume I have an RTC and I just give dummy values here as a start so that the rtc function returns something, where does that error actually come from ?
Well that is VERY odd - line 12 does not have a '*' token as suggested in the error message? Could "RTC" have been defined as a macro prior to this somewhere?
(Oh, just a minute, you said Xmega - could their .h files have something called "RTC" by any chance?)
But as a programmer you could have worked this out too. If line 12 was the point of the error (it was) then you have to ask yourself how was the C compiler seeing a "*" on that line. Using the -E option on the compiler is always a good idea to see what the code looks like with any macros expanded. But it was a fair bet that it was a macro. So then you ask yourself "have I defined a macro called RTC?", if not then it must have come from system header files. At which point you use your programmer's experience to guess where/why a macro called "RTC" might be defined.
Posted by theseapalm: Sat. Nov 20, 2010 - 01:13 AM
1
2
3
4
5
Total votes: 0
I made an account just to thank you kubark42. I wasted one day trying to port the sample code from FATfs on my own. Then I got serious and wasted another half day before I found your TUT which fixed a lot of the other things I wasn't noticing. I was able to get it up and running in a few hours with your TUT. I originally had the card powered straight from my 3.3V but noticed your comment to connect it to an output on the AVR and this had me going in circles for a bit till I noticed another post said not to do that.
I am porting for ATMEGA1284p. WinAVR-20100110, FATfs sample code of October 14, 2010.
I wasn't able to use the mmc.c function for select() that you had because my version of the sample code required a return value. So I tried my best to merge your function with the original.
static
int select (void) // 1:Successful, 0:Timeout //
{
SD_CS_PORT &= ~(1<<SD_CS_PIN); /* MMC CS = L */
if (!wait_ready()) {
DESELECT();
return 0;
}
return 1;
}
Also, I believe chk_power(void) was renamed to power_status(void) in my version of the sample code. I left both in just in case, but the compiler let me know chk_power() was not used.
I also changed the rtc.c return data types to int instead of BOOL. Because the compiler was complaining.
Glad to hear it! Sometime in the future, when I need to use SD cards again, I'll update the tutorial to reflect Chen's new code. I wouldn't count on that anytime soon, though.
Thanks for publishing your modifications here. I'm sure they'll be put to good use by others.
- What are the .h and .c files needed to make a data logger ? There are many files like: mmc.c, diskio.h , ff.h, etc. Wich ones are the essentials to the FATFS lib run like the original one ?
You can drop rtc.c all together. The only calls made to rtc.c are from the example program in main.c. It calls to rtc_init(), rtc_settime() and rtc_gettime(). It does that in:
static
void IoInit ()
{
PORTA = 0b11111111; // Port A
PORTB = 0b10110000; // Port B
DDRB = 0b11000000;
PORTC = 0b11111111; // Port C
PORTD = 0b11111111; // Port D
PORTE = 0b11110010; // Port E
DDRE = 0b10000010;
PORTF = 0b11111111; // Port F
PORTG = 0b11111; // Port G
uart_init(); // Initialize UART driver
/*
OCR1A = 51; // Timer1: LCD bias generator (OC1B)
OCR1B = 51;
TCCR1A = 0b00010000;
TCCR1B = 0b00001010;
*/
OCR2 = 90-1; // Timer2: 100Hz interval (OC2)
TCCR2 = 0b00001101;
TIMSK = 0b10000000; // Enable TC2.oc, interrupt
rtc_init(); // Initialize RTC
/*---------------------------------------------------------*/
/* User Provided Timer Function for FatFs module */
/*---------------------------------------------------------*/
/* This is a real time clock service to be called from */
/* FatFs module. Any valid time must be returned even if */
/* the system does not support a real time clock. */
/* This is not required in read-only configuration. */
DWORD get_fattime ()
{
RTC rtc;
/* Get local time */
rtc_gettime(&rtc);
/* Pack date and time into a DWORD variable */
return ((DWORD)(rtc.year - 1980) << 25)
| ((DWORD)rtc.month << 21)
| ((DWORD)rtc.mday << 16)
| ((DWORD)rtc.hour << 11)
| ((DWORD)rtc.min << 5)
| ((DWORD)rtc.sec >> 1);
}
This is the only one of any importance. The value returned from this function is used to time stamp the files when they are created/written. What I've done is:
That just means all files are stamped "12:00 1-1-2009".
Either provide your own RTC functionality and arrange for the result to be given in response to get_fattime() or do what I've done and all files will have a fixed date/time.
so even when i compile for attiny the sample of pfFS has errors:
../usi.S: Assembler messages:
../usi.S:19: Error: constant value required
../usi.S:19: Error: number must be positive and less than 64
../usi.S:64: Error: constant value required
../usi.S:64: Error: number must be positive and less than 64
../usi.S:71: Error: constant value required
../usi.S:71: Error: number must be positive and less than 64
make: *** [usi.o] Error 1
Build failed with 1 errors and 0 warnings...
As I think I told you via PM. John Samperi and I have modified the PetitFs code to work on Megas that don't have USI but that do have real UARTs and SPIs. Search out the threads and download the code.
BTW this is not an appropriate thread to continue the diagnose of your PetitFs porting problems - take it to "AVR Forum".
Posted by san_juan_dad: Mon. Jan 17, 2011 - 05:31 PM
1
2
3
4
5
Total votes: 0
Many thanks to everyone that has contributed to this TUT.
I now have FatFS running on a 644p and can:
1) Initialize the disk
2) List directories
3) Open and close a file, with a valid time stamp
But, writing to a file seems to have me stumped. I assume the following process is about right, so correct me please:
a) Open a file for write
b) Write to the “buff†until you have 512, or more bytes
c) Write the first 512 to a sector, using “disk_writeâ€
d) When done, flush the buffer
e) Close the file
My hang-up is that the disk_write function wants to know the “sectorâ€. That’s where I’m stuck. Can anyone help me across this knowledge gap?
The sector it's asking for is the memory location of the 512-byte page that you want to write. I haven't used FatFS since I wrote the tutorial, and subsequently rewrote many of the functions to minimize the size and maximize write performance for a very specific task, so I no longer recall exactly how with FatFS you get the sector location after you open the file.
However, I'm certain it will be instantly obvious if you spend a couple minutes looking in the right places. Try backtracking using the example code to see where it gets the sector from.
In any case, this is important, as if you write to the beginning of the file, you're overwriting it, whereas if you're writing to the end you're appending to it. I'm certain you can appreciate the nuance!
I successfully followed this tutorial in April 2009 using same ucontroller as the OP, I did have just some issues with pull ups, but not a big deal as I posted.
Now, based on that the code reported for other members seemed to be just below 32 K . I've attemped to get the FaTFs with an ATMEGA328.
I've downloaded the latest version from elm-chang R08b April 2011 and found out same name changes that clash with the tutorial posted at the beginning of the thread.
For example the chk_power() function in old version is now called power_status(). I am not sure if there are other things.
The problem is that after it compiled with zero errors this is the result:
I've attempted to use the _FS_MINIMIZE parameter but it seems to be there is a bug on the automatization directives as plenty of errors shows up from the calling of the functions supposed to be suppressed in case of using 1,2 or 3, so it only compiles OK with this parameter set to ZERO. I attempted to remove the terminal functions related , but errors still come from other terminal functions not supposed to be suppressed...
So, my question is if anyone know whether this last version may have more functions or what I am doing wrong?
I have attached the complete project. It has the modified rtc.c , however it uses the original uart.c and uart.h from Chang.
Based on the answers if this is not possible to run on an ATMEGA328, then I will look around your modified Petit_FS
posted before as well as the Roland Riegel that is for an ATMEGA168.
Last but not least, the application I am aiming to is to play WAV files from SD card using the PWM. So I just need to read . However,as a side effect I wanted to see if I could fit the whole nine yards on the 328.
Please disregard previous crazy post. The only modifications done on the code posted was on the SPI pins as the TX RX on the m164 are the same as on m/168/328.
I like the UART implementation in asm. The only question I have for this post is about the comment from JS
//The comms is duplex,38.4kbps, but there is no echo and local
// echo needs to be enabled on the terminal.
What does this mean ? no echo as well as "local echo" ?
What happened when you typed the message above? Did you see what you were typing?
If you type a line into petitfs you would NOT see anything on a terminal that has a single screen instead of a split send and receive screen, well pretty much like the screen you are reading now. This is the reason for local echo.
Local echo will let you see what you type so that, if you make a mistake and you see it you can edit the line.
I don't remember ever having used a split display terminal program, I always use character echo in my programs that needs input ie the USART receives a char from the keyboard, puts it into a buffer and then sends it back to the terminal.
In rare cases where this doesn't happen in a program (not written by me) I use local echo.
Do you have the ability to have a single screen with Brays instead of 2? If so use it and you will see what I mean.
This is as conprehensive an explanation as I can provide. :)
Thanks a lot I have the correct picture now as I also write the USART routines like in Petit that do the same thing just plain send and plain receive but I always use Bray's terminal ( attached) because you can send and receive in Hexadecimal and you can make some macros that are convenient.
[url] http://hw-server.com/software/te...
[/url]
This is why I've got in trouble most of the time with the Hyperterminal. :oops:
if someone can share with me any code that can be used with an atmega32 I will be very happy after losing already a week(24 hour a day) trying to have something working on a sd card.
I have read the tutorials, this thread also. I see how the people has succed but I am UNABLE. I started with an atmega16 and changed to atmega32 thinking that atmega16 was insufficient. now I see the code is still to big.
also it seems that the files that were used for this tutorial already changed.
I got this with the elmchan full module. how the... people is getting 10kb codes...
I try to do with the petitfs code but there is always something missing that make me include files from the full module... and I end up will errors and more errors. may be the full version code is ready to run but this small one...I compile the file and I get thousand of errors. If someone has succed with a code smaller than 32kb please share it with me. I am suffering.:-(
I am using avrstudio5. I have done all kind of small projects with this software. All successfull till this.
BTW, I am a bit confused with the make file. Do I need to handle son makefile? I didn't in the previous projects.
The you kind of deserve everything that you get ;-)
Obviously if you DO want to use AS5 and don't want to use it's option to "use external makefile" (I assume it has one like AS4?) then at least start by adding all the .c files from the pfsample/avr to a project set to build for tiny85 and see what errors remain. Once you can get it working for the tiny85 it's designed to build for THEN consider what needs to be done to port it to some other model of AVR.
I repeat the readdir 4 times because from what I saw on the fatfs website it looked like it returned:
.
..
firstfile
secoundfile
or similar format, so I readdir 4 times to hopefully get past any invalid fname[]s
I realise running it 4 times is not ideal, but I like to keep things as basic as I can till its actually working, as im not very adept at coding.
There are multiple mp3 files in the root of the sdcard, and I can play them if I put the file name in the code.
In the code above the default.mp3 plays, so when there is an error when I try playing the current fname[].
I also tried sending the fname[] to an lcd, however it just displayed blanks(im not sure if I have the timing 100% correct for the lcd yet either).
So if anyone can explain what I am doing wrong or offer a solution, I would appreciate that. I am not looking for anyone to write code for me or anything, I just need a little help.
Retrosexual, instead of FOUR readdir(), just get the file_name and check the extension for "mp3", and if it is continue, else loop up and do ONE readdir() / file from the start.
1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1
Posted by a.mlw.walker: Wed. Oct 26, 2011 - 05:27 PM
1
2
3
4
5
Total votes: 0
I get the initialization appearing in the serial terminal, but after that the commands just echo themselves?
FatFs module test monitor for AVR
LFN Disabled, Code page: 1
>di 0
di 0fi 0
fi 0fl
fl
Any ideas why?
Posted by NilRecurring: Tue. Jan 17, 2012 - 05:13 PM
1
2
3
4
5
Total votes: 0
I have a tiny question about Makefile_mmc -- something I sort of fixed already, but I'd like to know incase I broke something. The makefile included with the FATFS library for the AVR had the following line:
I understand why all the files are included except sound.c. What is sound.c? I don't have it in the AVR folder and so my project wouldn't compile. I ditched the makefile and I'm now using AVR Studio 4's makefile. I included the usual files for the project [uart.c, ff.c, mmc.c, rtc.c and cc932_avr.c] and after some changes (like the one's described in this TUT) the project compiles fine.
I can't upload it to my AVR as my board is being assembled so I thought I'd ask here. It's a small question so I didn't feel the need for an entirely new thread. If a MOD feels I'm wrong regarding this, please let me know and I'll create a new thread.
You seriously don't want that! Edit the ffconf.h and change the code page to be plain ascii. You don't want 10K of Kanji Japanese built into your program.
The sound.c things sounds(sic!) like an error. There is no sound.c in the ffsample.zip\avr directory.
Surely this was discussed earlier in the thread? Anyway most AVRs don't have an RTC so there's no way to give accurate timestamps to the files that are created. The only function ff.c actually calls is get_fattime() so in your own main.c (or some appropriate .c file) just use:
then remove any other references to "RTC". The above just arranges for all files to have a time stamp of "12:00:00 1/1/2009"
- Log in or register to post comments
Topthat's what I did... or didn't I ?
- Log in or register to post comments
TopRead again. The function I'm talking about is get_fattime() not rtc_gettime() or rtc_settime(). Just leave rtc.c out of the list of files to build in the makefile and the only "Undefined reference" you'll see is to get_fattime(). So now just provide that dummy function I showed in one of the .c files that IS still being built.
- Log in or register to post comments
Topah, yes, ok. Will do, thank you.
Taking the risk to annoy you, but let's assume I have an RTC and I just give dummy values here as a start so that the rtc function returns something, where does that error actually come from ?
- Log in or register to post comments
TopWhich line is line 12 in rtc.h ? The error messages say you have errors on lines 12, 18 and 19.
(note however that sometimes you get an error on line N because of a fault on a prior line)
- Log in or register to post comments
TopI edited the respective line numbers above in the code
- Log in or register to post comments
TopWell that is VERY odd - line 12 does not have a '*' token as suggested in the error message? Could "RTC" have been defined as a macro prior to this somewhere?
(Oh, just a minute, you said Xmega - could their .h files have something called "RTC" by any chance?)
EDIT: just checked - guess what:
So rename this typedef to FS_RTC rather than just RTC.
- Log in or register to post comments
Topwow, great, that's it. Very good thinking, thank you very much once again !
- Log in or register to post comments
TopBut as a programmer you could have worked this out too. If line 12 was the point of the error (it was) then you have to ask yourself how was the C compiler seeing a "*" on that line. Using the -E option on the compiler is always a good idea to see what the code looks like with any macros expanded. But it was a fair bet that it was a macro. So then you ask yourself "have I defined a macro called RTC?", if not then it must have come from system header files. At which point you use your programmer's experience to guess where/why a macro called "RTC" might be defined.
- Log in or register to post comments
TopI made an account just to thank you kubark42. I wasted one day trying to port the sample code from FATfs on my own. Then I got serious and wasted another half day before I found your TUT which fixed a lot of the other things I wasn't noticing. I was able to get it up and running in a few hours with your TUT. I originally had the card powered straight from my 3.3V but noticed your comment to connect it to an output on the AVR and this had me going in circles for a bit till I noticed another post said not to do that.
I am porting for ATMEGA1284p. WinAVR-20100110, FATfs sample code of October 14, 2010.
I wasn't able to use the mmc.c function for select() that you had because my version of the sample code required a return value. So I tried my best to merge your function with the original.
Also, I believe chk_power(void) was renamed to power_status(void) in my version of the sample code. I left both in just in case, but the compiler let me know chk_power() was not used.
I also changed the rtc.c return data types to int instead of BOOL. Because the compiler was complaining.
Thanks again for your help and work!
- Log in or register to post comments
TopGlad to hear it! Sometime in the future, when I need to use SD cards again, I'll update the tutorial to reflect Chen's new code. I wouldn't count on that anytime soon, though.
Thanks for publishing your modifications here. I'm sure they'll be put to good use by others.
- Log in or register to post comments
TopHi, I'm trying to use this lib into my mega644 to build a simple data logger, but I'm stuck with all this libs, codes and functions.
I've read the tutorial and made all the changes that kubark42 said to be done, but the code still don't compile. Here is the log:
When double clicking the error, it points to these lines of the code:
I can't figure out what problem is going on.
Another thing that i would like to ask:
- What are the .h and .c files needed to make a data logger ? There are many files like: mmc.c, diskio.h , ff.h, etc. Wich ones are the essentials to the FATFS lib run like the original one ?
Sorry for any mistake in my english.
- Log in or register to post comments
TopYou can drop rtc.c all together. The only calls made to rtc.c are from the example program in main.c. It calls to rtc_init(), rtc_settime() and rtc_gettime(). It does that in:
Just remove this call.
Just remove this entire "case 't'". Finally:
This is the only one of any importance. The value returned from this function is used to time stamp the files when they are created/written. What I've done is:
That just means all files are stamped "12:00 1-1-2009".
Either provide your own RTC functionality and arrange for the result to be given in response to get_fattime() or do what I've done and all files will have a fixed date/time.
- Log in or register to post comments
TopHave someone edited this code for atmega8 ?
- Log in or register to post comments
TopYou won't get FatFs to fit in a mega8 bit petitFs will - the smallest build is something like just 4K
- Log in or register to post comments
TopDamn, so i probably went for nothing through this tut ;/ Can petitFS create a file? I have read that it just can't ;/
- Log in or register to post comments
TopSuggest you read:
http://elm-chan.org/fsw/ff/00ind...
Rather than believing every bit of tittle-tattle you read on the Internet.
- Log in or register to post comments
TopSo to do this working at atmega8 from attiny85 i just need to change the makefile and those lines in main.c ?
- Log in or register to post comments
Topso even when i compile for attiny the sample of pfFS has errors:
- Log in or register to post comments
TopA few links that may help you.
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
- Log in or register to post comments
TopThank you a lot, that's what I needed
- Log in or register to post comments
TopAs I think I told you via PM. John Samperi and I have modified the PetitFs code to work on Megas that don't have USI but that do have real UARTs and SPIs. Search out the threads and download the code.
BTW this is not an appropriate thread to continue the diagnose of your PetitFs porting problems - take it to "AVR Forum".
- Log in or register to post comments
TopMany thanks to everyone that has contributed to this TUT.
I now have FatFS running on a 644p and can:
1) Initialize the disk
2) List directories
3) Open and close a file, with a valid time stamp
But, writing to a file seems to have me stumped. I assume the following process is about right, so correct me please:
a) Open a file for write
b) Write to the “buff†until you have 512, or more bytes
c) Write the first 512 to a sector, using “disk_writeâ€
d) When done, flush the buffer
e) Close the file
My hang-up is that the disk_write function wants to know the “sectorâ€. That’s where I’m stuck. Can anyone help me across this knowledge gap?
Tom
- Log in or register to post comments
TopThe sector it's asking for is the memory location of the 512-byte page that you want to write. I haven't used FatFS since I wrote the tutorial, and subsequently rewrote many of the functions to minimize the size and maximize write performance for a very specific task, so I no longer recall exactly how with FatFS you get the sector location after you open the file.
However, I'm certain it will be instantly obvious if you spend a couple minutes looking in the right places. Try backtracking using the example code to see where it gets the sector from.
In any case, this is important, as if you write to the beginning of the file, you're overwriting it, whereas if you're writing to the end you're appending to it. I'm certain you can appreciate the nuance!
- Log in or register to post comments
TopI successfully followed this tutorial in April 2009 using same ucontroller as the OP, I did have just some issues with pull ups, but not a big deal as I posted.
Now, based on that the code reported for other members seemed to be just below 32 K . I've attemped to get the FaTFs with an ATMEGA328.
I've downloaded the latest version from elm-chang R08b April 2011 and found out same name changes that clash with the tutorial posted at the beginning of the thread.
For example the chk_power() function in old version is now called power_status(). I am not sure if there are other things.
The problem is that after it compiled with zero errors this is the result:
I've attempted to use the _FS_MINIMIZE parameter but it seems to be there is a bug on the automatization directives as plenty of errors shows up from the calling of the functions supposed to be suppressed in case of using 1,2 or 3, so it only compiles OK with this parameter set to ZERO. I attempted to remove the terminal functions related , but errors still come from other terminal functions not supposed to be suppressed...
So, my question is if anyone know whether this last version may have more functions or what I am doing wrong?
I have attached the complete project. It has the modified rtc.c , however it uses the original uart.c and uart.h from Chang.
Based on the answers if this is not possible to run on an ATMEGA328, then I will look around your modified Petit_FS
posted before as well as the Roland Riegel that is for an ATMEGA168.
Last but not least, the application I am aiming to is to play WAV files from SD card using the PWM. So I just need to read . However,as a side effect I wanted to see if I could fit the whole nine yards on the 328.
Thanks in advance for any advice.
Jose
Attachment(s):
- Log in or register to post comments
TopI've successfully run the Petit FS from Cliff / JS on the Atmega328
Biiiig difference. Not even a 328 is needed.
Please disregard previous crazy post. The only modifications done on the code posted was on the SPI pins as the TX RX on the m164 are the same as on m/168/328.
I like the UART implementation in asm. The only question I have for this post is about the comment from JS
What does this mean ? no echo as well as "local echo" ?
Thanks a million in advance,
Jose v.
- Log in or register to post comments
TopIn the terminal mode you will not see what you are typing unless you enable echo mode in your terminal progam. If you are using Hyperterminal
Attachment(s):
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
- Log in or register to post comments
TopJs,
Thanks, I used Bray's terminal and it has a separated tx rx input display.
But, forgive my ignorance on this, how a Hyperterminal feature is related to the USART firmware?
Does this means that the atmega built-in USART automatically echoes on TX what is coming on RX ?and that was no available in Chang's implementation ?
I was playing with single line USART some time ago and I disabled RX when transmitting to avoid self receiving , but I did not verified the opposite.
Thanks for any input. Regards,
Jose v.
- Log in or register to post comments
TopWhat happened when you typed the message above? Did you see what you were typing?
If you type a line into petitfs you would NOT see anything on a terminal that has a single screen instead of a split send and receive screen, well pretty much like the screen you are reading now. This is the reason for local echo.
Local echo will let you see what you type so that, if you make a mistake and you see it you can edit the line.
I don't remember ever having used a split display terminal program, I always use character echo in my programs that needs input ie the USART receives a char from the keyboard, puts it into a buffer and then sends it back to the terminal.
In rare cases where this doesn't happen in a program (not written by me) I use local echo.
Do you have the ability to have a single screen with Brays instead of 2? If so use it and you will see what I mean.
This is as conprehensive an explanation as I can provide. :)
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
- Log in or register to post comments
TopJohn,
Thanks a lot I have the correct picture now as I also write the USART routines like in Petit that do the same thing just plain send and plain receive but I always use Bray's terminal ( attached) because you can send and receive in Hexadecimal and you can make some macros that are convenient.
[url]
http://hw-server.com/software/te...
[/url]
This is why I've got in trouble most of the time with the Hyperterminal. :oops:
Thanks again,
Jose v.]
Attachment(s):
- Log in or register to post comments
Topif someone can share with me any code that can be used with an atmega32 I will be very happy after losing already a week(24 hour a day) trying to have something working on a sd card.
I have read the tutorials, this thread also. I see how the people has succed but I am UNABLE. I started with an atmega16 and changed to atmega32 thinking that atmega16 was insufficient. now I see the code is still to big.
also it seems that the files that were used for this tutorial already changed.
I got this with the elmchan full module. how the... people is getting 10kb codes...
thankyou.
- Log in or register to post comments
TopJohn Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
- Log in or register to post comments
TopI try to do with the petitfs code but there is always something missing that make me include files from the full module... and I end up will errors and more errors. may be the full version code is ready to run but this small one...I compile the file and I get thousand of errors. If someone has succed with a code smaller than 32kb please share it with me. I am suffering.:-(
what I am doing wrong??
- Log in or register to post comments
TopTell us more about "something missing"?!?
For me pfsample\avr builds right after download:
- Log in or register to post comments
TopPost the first error that you see.
- Log in or register to post comments
TopI downloaded the petit module examples file. I choise AVR folder and I try to compile it.I know I can get some error regarding with the pinout but...
134 errors
undefined reference to 'xmit'
'xfunc_out'
'xputs'
'crvr'
'xmit_spi'.....
- Log in or register to post comments
TopWhat were you compiling it with? I have WinAVR20100110 installed which is what runs when I typed "make" above.
- Log in or register to post comments
TopI am using avrstudio5. I have done all kind of small projects with this software. All successfull till this.
BTW, I am a bit confused with the make file. Do I need to handle son makefile? I didn't in the previous projects.
- Log in or register to post comments
TopThe you kind of deserve everything that you get ;-)
Obviously if you DO want to use AS5 and don't want to use it's option to "use external makefile" (I assume it has one like AS4?) then at least start by adding all the .c files from the pfsample/avr to a project set to build for tiny85 and see what errors remain. Once you can get it working for the tiny85 it's designed to build for THEN consider what needs to be done to port it to some other model of AVR.
- Log in or register to post comments
Tophttps://www.avrfreaks.net/index.p...
and also this from above
https://www.avrfreaks.net/index.p...
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
- Log in or register to post comments
Topthank you guys, I run out of time. the gf hijacks me for holidays, so no more chips.
thank you again.
- Log in or register to post comments
TopHi,
Im trying to use fatfs on an mp3 player project I am doing.
I am having trouble with the f_readdir function.
Im trying to find a way of finding a file with the MP3 extension.
However I can't seem to even open a file from the FILINFO fname[], and I am unsure if I am doing it right...
The following code is my attempt
I repeat the readdir 4 times because from what I saw on the fatfs website it looked like it returned:
.
..
firstfile
secoundfile
or similar format, so I readdir 4 times to hopefully get past any invalid fname[]s
I realise running it 4 times is not ideal, but I like to keep things as basic as I can till its actually working, as im not very adept at coding.
There are multiple mp3 files in the root of the sdcard, and I can play them if I put the file name in the code.
In the code above the default.mp3 plays, so when there is an error when I try playing the current fname[].
I also tried sending the fname[] to an lcd, however it just displayed blanks(im not sure if I have the timing 100% correct for the lcd yet either).
So if anyone can explain what I am doing wrong or offer a solution, I would appreciate that. I am not looking for anyone to write code for me or anything, I just need a little help.
- Log in or register to post comments
TopYou definitely need some kind of "debug channel" - either verify that the LCD can be trusted or consider a UART link to a PC.
- Log in or register to post comments
TopOh man this is embarrassing, feel like a total retard now
had quotes around fn...
Got the LCD working properly too, pretty new to this stuff. Realized I need to use sprintf to convert it to a char array...
- Log in or register to post comments
TopRetrosexual, instead of FOUR readdir(), just get the file_name and check the extension for "mp3", and if it is continue, else loop up and do ONE readdir() / file from the start.
1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1
- Log in or register to post comments
TopI get the initialization appearing in the serial terminal, but after that the commands just echo themselves?
FatFs module test monitor for AVR
LFN Disabled, Code page: 1
>di 0
di 0fi 0
fi 0fl
fl
Any ideas why?
- Log in or register to post comments
TopAd printf()s to the control loop and find out. That's what debugging is all about!
- Log in or register to post comments
TopI have a tiny question about Makefile_mmc -- something I sort of fixed already, but I'd like to know incase I broke something. The makefile included with the FATFS library for the AVR had the following line:
I understand why all the files are included except sound.c. What is sound.c? I don't have it in the AVR folder and so my project wouldn't compile. I ditched the makefile and I'm now using AVR Studio 4's makefile. I included the usual files for the project [uart.c, ff.c, mmc.c, rtc.c and cc932_avr.c] and after some changes (like the one's described in this TUT) the project compiles fine.
I can't upload it to my AVR as my board is being assembled so I thought I'd ask here. It's a small question so I didn't feel the need for an entirely new thread. If a MOD feels I'm wrong regarding this, please let me know and I'll create a new thread.
- Log in or register to post comments
TopYou seriously don't want that! Edit the ffconf.h and change the code page to be plain ascii. You don't want 10K of Kanji Japanese built into your program.
The sound.c things sounds(sic!) like an error. There is no sound.c in the ffsample.zip\avr directory.
- Log in or register to post comments
TopI think there is a project for a MP3 player around which MAY use that file.
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
- Log in or register to post comments
TopPages