This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

trouble over trouble

Hello

I'm working with the AT91RM9200 from Atmel and I have some problems with data abort. The stack size is big enough. I tested it by making the user stack size zero and see which errors now occured. Everything was overwritten by other things. At the moment my stack size is 0x00000200. The error which occured is that the ptr to the usart base address is overwritten either if the usart.o is stored in the internal ram or the external ram. I use the watch window to see if the ptr would change his value - but nothing happens. I only know that the value is changed because I set a dummy within the retarget function for printf() - (thanks for the hint Per).

The whole programm only includes the ethernet init part, the usart and retarget function in separate c-files. So I have one main file with only the main routine where I init all other functions by calling the right function. In the while loop (main.c) I only poll if a flag is set by receiving a new frame by the ethernet. This works with the data abort problems.

These problems don't appear always at the same part of code. Is my acceptance right, that if I would have a stack size problem, the error would occurred always at the same part of code?

When I test the whole programm several times, I have one or two passes where no error occured. Very often the error happened bevor I call the init function for the ethernet part. So I don't think there would be a error during the execution of the code. I think the error could / must be very global.
If I don't include the ethernet part, then I got no data abort error. But I'm not able to find the / or these problems.

the headerfile of the ethernet part:

#define AT91C_EMAC_TDLIST_BASE                     0x21000000                                              /* */
#define ETH_PACKET_SIZE                 1536                                            /* greater than 1518 or 1522 (VLAN) bytes */
#define NB_ETH_RX_PACKETS               10                                                              /* number of RX buffer */
#define EMAC_RXBUF_ADD_WRAP                             0x02                                                    /* WRAP Bit at the end of the list descriptor */
#define MII_STS_REG                                     0x01
#define MII_STS2_REG                                    0x11
#define RxPacket (AT91C_EMAC_TDLIST_BASE + (8 * NB_ETH_RX_PACKETS))

typedef struct {
     unsigned int   RxBufAddr;
     unsigned int   RxBufStatus;
} *EMAC_pRX_descriptor;

void Phy_Init(void);

0