Go Down

Topic: Trouble with Serial1 port in SPI mode - Port mapping problem on 2560? (Read 243 times) previous topic - next topic

diesel

Hello,

I am using a Seeduino Mega 2560 mega. Very similar to Arduino mega 2560, except it has accessible headers for some of the pins that are not accessible on the Arduino mega. I am able to run the 1st serial port(Serial) in SPI mode, but I am having trouble running the 2nd serial port(Serial1) in SPI. I suspect it has to do with the missing port mappings when IDE compiles the code, but I am not sure how to fix. Can somebody give me a hint or lead on how to fix problem? 

Thanks,

-diesel

//Init
UBRR1H = 0;                                   
UCSR1A = _BV (TXC1);               
XCK1_DDR |= (1<<XCK1);                   
UCSR1C = _BV (UMSEL10) | _BV (UMSEL11);
UCSR1B = _BV (TXEN1) | _BV (RXEN1);   
UBRR1H =0;

//Transfer byte
while (!(UCSR1A & _BV (UDRE1)));
UDR1 = _data;
while (!(UCSR1A & _BV (RXC1)));
return UDR1;




Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy