Hi all, I'm trying to use a eeprom with my evaluation board (the one in the subject), so I added the code from the atmel site (AT91-AN01: Using the Two-wire interface (TWI) in Master Mode on AT91SAM Microcontrollers) to my adjusted version of FreeRTOS. In order to make things working, I have added lib_AT91SAM7S256.h to my project. This header is a set of inline functions useful to initialize and use the processor, without directly use the processor register. It does compile, but the problem now is that the example code downloaded from Atmel site stops working during the execution of AT91F_AT24C_WritePage(). It loop forever just here (into the while): [..snip..] /* Send the buffer to the page */ for ( Count=0; Count < NumOfBytes ;Count++ ) { ____AT91C_BASE_TWI->TWI_THR = *Buffer++; ____/* Wait until TXRDY is high to transmit the next data */ ____status = AT91C_BASE_TWI->TWI_SR; ____while (!(status & AT91C_TWI_TXRDY)) <---- it loops here ____status = AT91C_BASE_TWI->TWI_SR; } [..snip..] It seems that AT91C_TWI_TXRDY (or AT91C_BASE_TWI->TWI_SR) never becomes 0, but I can't wonder whi.. Anybody known the solution? Thanks a lot g4b0
Gabriele Brosulo wrote: > It seems that AT91C_TWI_TXRDY (or AT91C_BASE_TWI->TWI_SR) never becomes > 0, but I can't wonder whi.. Actually the while loop continues while the TXRDY bit is zero. It is waiting for it to become one not zero. (as per flowchart on page 14 of the app. note). However beyond helping you understand the meaning of the code it is not possible to say what the problem is from that snippet. You have called AT91F_TWI_Open() prior to this I presume? Clifford
If you are interested I developed a few FreeRTOS driver for AT91SAM7 (I2S, SPI, FAT, etc) if you are interested you can check it at: http://sistemasembebidos.com.ar/foro/?topic=727.0 Is a spanish spoken forum but the code is fully commented in english Regards, Marcelo
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.