leontti / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

Atnega16 SPI ports are wrong in u8g_com_atmega_hw_spi.c #208

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to use SPI on Atmega16 + UC1701

What is the expected output? What do you see instead?
We should see stuff on the screen!! Nothing appears instead.

What version of the product are you using? On what operating system?
Tested with 1.06, but latest source (1.14) doesn't seem to have fixed the issue 
according to the file u8g_com_atmega_hw_spi.c

Please provide any additional information below.
In u8g_com_atmega_hw_spi.c, it assumes SCK is at PORTB3 and MOSI at PB5 while 
they are at PB5 and PB7 resp. Also, slave select is assumed to be PB2 while it 
is PB4. Changing these in the source file fixes the issue. 
Concerned lines in u8g_com_atmega_hw_spi.c are 99 to 104 and line 138.

Check the datasheet for ATMEGA16 here:
http://www.atmel.com/Images/doc2466.pdf

Also SPI2X wasnt defined in my avr.h so I had to assign it manually but that is 
a different issue and seems to be fixed in the latest version.

Original issue reported on code.google.com by benoit.g...@gmail.com on 11 Oct 2013 at 3:39

GoogleCodeExporter commented 9 years ago
Sorry you have to swap MOSI and SCK in my message: MOSI should be PB5 and SCK 
PB7.

Original comment by benoit.g...@gmail.com on 11 Oct 2013 at 3:41

GoogleCodeExporter commented 9 years ago
The problem is: i can not support all different kind of existing hardware. 
Examples are good for ATMEGA88 type of controllers. Other displays will have 
mapped the SPI pins to other locations and may require some modifications.

But thanks for the hint. Maybe other users can benefit from your information.

Original comment by olikr...@gmail.com on 11 Oct 2013 at 7:03

GoogleCodeExporter commented 9 years ago
not sure how to proceed here... closing this...

Original comment by olikr...@gmail.com on 22 Jan 2014 at 8:02