Guten Abend Leute!
Ich bin sowohl neu hier im Forum als auch in der Mikrocontroller Welt :D
Mein Vorhaben:
Ich benutze das ATMEL SAM4E XPLAINED PRO BOARD und möchte an dessen
Extension Header EXT3 das ebenfalls von ATMEL OLED1 XPLAINED PRO
anschließen. Die Kommunikation soll über SPI erfolgen.
Ich benutze Atmel Studio 6.2 und das ASF.
Nun zu meinem Problem:
Ich erstelle ein neues Projekt für das SAM4E und füge mittels dem ASF
Wizard das Modul SSD1306 Controller in mein Projekt. Dadurch werden auch
automatisch die dazu benötigten Module wie IOPORT oder SPI hinzugefügt.
Dann belege ich in CONF_SSD1306.h die Pins:
1 | # define SSD1306_SPI_INTERFACE
|
2 | # define SSD1306_SPI SPI
|
3 |
|
4 | # define SSD1306_DC_PIN PIO_PD28_IDX
|
5 | # define SSD1306_CS_PIN PIO_PD30_IDX
|
6 | # define SSD1306_RES_PIN PIO_PD26_IDX
|
7 |
|
8 | # define UG_2832HSWEG04_BAUDRATE 5000000
|
Anschließend nehme ich folgende Initalisierung vor:
1 | ioport_set_pin_peripheral_mode(SPI_MISO_GPIO, SPI_MISO_FLAGS);
|
2 | ioport_set_pin_peripheral_mode(SPI_MOSI_GPIO, SPI_MOSI_FLAGS);
|
3 | ioport_set_pin_peripheral_mode(SPI_SPCK_GPIO, SPI_SPCK_FLAGS);
|
4 |
|
5 | ioport_set_pin_peripheral_mode(SPI_NPCS0_GPIO, SPI_NPCS0_FLAGS);
|
6 |
|
7 | ioport_set_pin_dir(PIO_PD28_IDX, IOPORT_DIR_OUTPUT);
|
8 | ioport_set_pin_mode(PIO_PD28_IDX, IOPORT_MODE_PULLUP);
|
9 | ioport_set_pin_dir(PIO_PD26_IDX, IOPORT_DIR_OUTPUT);
|
10 | ioport_set_pin_mode(PIO_PD26_IDX, IOPORT_MODE_PULLUP);
|
Wenn ich nun im Debugger mein Programm Schritt für Schritt durchgehe und
SSD1306_INIT() aufgerufen wird, kommt es hier in der Funktion
SSD1306_WRITE_COMMAND zu einem "Fehler". Der Befehl
spi_deselect_device(SSD1306_SPI, &device);
endet in einer Endlosschleife...
Kann mir bitte jemand weiterhelfen? Ich sitze schon seit Tagen an diesem
Problem fest und weiß nicht was ich hier falsch mache..
Danke schon mal im Voraus :)!