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

printf data abort - (again)

Hello,

I've problems with the printf() routine. I receive frames over the ethernet in a very short intervall. If I received a frame I set a flag in the ISR.

void ethernet_interrupt(void) __irq
{
        unsigned int status;
        AT91PS_EMAC pEmac = AT91C_BASE_EMAC;

        status = pEmac->EMAC_ISR;

        if (status & AT91C_EMAC_RCOM)                               /* Receive complete */
                Emac_Receive++;

        // clear receive status register
        pEmac->EMAC_RSR  &= ~(AT91C_EMAC_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA);
        AT91C_BASE_AIC->AIC_EOICR = 0;                               /* End of ISR */

}

In the main routine I ask if the flag is set -> if it is set, I use printf() to see via the usart that I get a new frame...

printf("h");

The problem is that I always get a data abort within the printf() routine..

Could it be that the ethernet frames came to close together (in a short time) so that the printf() routine has not finish to transmit the last character?

And after the ISR the printf() routine don't know what to do / what to send -> data abort??

If the printf-argument is much bigger - it is often so that I only can transmit one or two letter - but not the whole word...

e.g.

printf("hello world\n");

I only transmit "hel" - that's all...

best regards
Johannes

Parents
  • that's the whole code + the retarget function...

    int COM1_1_sendchar(int ch);
    
    unsigned int Emac_Receive = 0;
    unsigned int buffer = 0, overrun = 0;
    
    #define MCK     60000000                                                                        /* Clock-Rate für USART */
    AT91PS_USART COM1_1 = AT91C_BASE_US1;                                   /* Variable COM1 für die Struct _AT91S_USART definieren */
    
    
    void initialize_usart1()
    {
        AT91F_PIO_CfgPeriph(AT91C_BASE_PIOB,AT91C_PB21_RXD1 | AT91C_PB20_TXD1,0);
            AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1<<AT91C_ID_US1 ) ;
            AT91F_US_Configure (COM1_1, MCK,AT91C_US_ASYNC_MODE, 115200, 0);
            COM1_1->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
    //      AT91F_US_EnableIt(COM1_1, AT91C_US_TXRDY);                      //enable AT91C_US_TXRDY interrupt
    }
    
    
    
    
    int main(void)
    {
    //      int status;
    
            initialize_usart1();
            printf("usart_init\n");
            printf("done\n");
    
    //      status = ethernet();                                                    /* Ethernet */
    
            printf("Emac init\n");
    
            while(1);
    }
    

    Johannes

Reply
  • that's the whole code + the retarget function...

    int COM1_1_sendchar(int ch);
    
    unsigned int Emac_Receive = 0;
    unsigned int buffer = 0, overrun = 0;
    
    #define MCK     60000000                                                                        /* Clock-Rate für USART */
    AT91PS_USART COM1_1 = AT91C_BASE_US1;                                   /* Variable COM1 für die Struct _AT91S_USART definieren */
    
    
    void initialize_usart1()
    {
        AT91F_PIO_CfgPeriph(AT91C_BASE_PIOB,AT91C_PB21_RXD1 | AT91C_PB20_TXD1,0);
            AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1<<AT91C_ID_US1 ) ;
            AT91F_US_Configure (COM1_1, MCK,AT91C_US_ASYNC_MODE, 115200, 0);
            COM1_1->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
    //      AT91F_US_EnableIt(COM1_1, AT91C_US_TXRDY);                      //enable AT91C_US_TXRDY interrupt
    }
    
    
    
    
    int main(void)
    {
    //      int status;
    
            initialize_usart1();
            printf("usart_init\n");
            printf("done\n");
    
    //      status = ethernet();                                                    /* Ethernet */
    
            printf("Emac init\n");
    
            while(1);
    }
    

    Johannes

Children