I am trying to use the AVRlib uart code to get the uart working on my ATmega2560.
The ATmega2560 has four uarts, but AVRlib only has a two uart file called uart2.c. A quick google search did not yield any source code for ATmega2560 uart.
Normally this wouldn't be a problem, as uart2.c looks easily hackable to four uarts. Plus, I've gotten the normal uart.h to work on my ATmega644.
However, compiling the unmodified uart2.c code gives me these errors:
uart4.c: In function 'uartSendByte':
uart4.c:167: error: 'UDRE' undeclared (first use in this function)
uart4.c:167: error: (Each undeclared identifier is reported only once
uart4.c:167: error: for each function it appears in.)
uart4.c: At top level:
uart4.c:357: warning: 'SIG_UART0_TRANS' appears to be a misspelled signal handler
uart4.c:363: warning: 'SIG_UART1_TRANS' appears to be a misspelled signal handler
uart4.c:369: warning: 'SIG_UART0_RECV' appears to be a misspelled signal handler
uart4.c:375: warning: 'SIG_UART1_RECV' appears to be a misspelled signal handler
Anyone know how to fix this?
I'm not the most skilled of programmers (actually, I'm a mechanical engineer) . . . so try to dumb down any of your comments for me =P
when I say unmodified, I only changed these lines:
bufferInit(&uartRxBuffer, uart0RxData, UART0_RX_BUFFER_SIZE); bufferInit(&uartTxBuffer, uart0TxData, UART0_TX_BUFFER_SIZE);
to these lines:
bufferInit(&uartRxBuffer, (u08*) uart0RxData, UART0_RX_BUFFER_SIZE); bufferInit(&uartTxBuffer, (u08*) uart0TxData, UART0_TX_BUFFER_SIZE);
to correct for an AVRlib bug (the fix works fine for uart.c)