Hallo,
ich habe einen LM3S9B92 von Luminary und versuche die SSI Schnittstelle
für einen IC welcher über SPI angesprochen wird anusprechen.
Anhand von Beispielprogrammen (Blinky, UART) habe ich versucht die SSI
Schnittstelle zu aktivieren.
Jedoch habe ich ein Problemm mit der Funktion
SSIConfigSetExpClk(SSI0_BASE,...).
Sbald ich diese Funkiton einbinde, spring mir das Programm während des
Debuggen in die startup_ccs.c in die folgende Interruptroutine und
bleibt dort hängen.
//**********************************************************************
*
// This is the code that gets called when the processor receives a fault
// interrupt. This simply enters an infinite loop, preserving the
system state for examination by a debugger.
//**********************************************************************
*
static void
FaultISR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
Durch viel probieren und alles außer dieser Funktion auskommentieren,
bin ich mir sicher das die SSI0_BASE das Problem darstellt, nur weiss
ich nicht wieso schliesslich ist die SSI0_BASE als 0x40008000 definiert.
Danke im voraus.
Gruß
Peter
Hallo Robert, das Developmentboard funktioniert, habe die Beispielprogramme getestet und mnimal verändert. Der IC den ich über SSI ansteuern möchte ist angeschlossen. Jedoch ist auf den SPI Leitungen kein Takt/Signal. Gruß Peter
Hallo Andreas,
hier ist mein kompletter Code.
#include "inc/lm3s9b92.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "utils/uartstdio.h"
//SPI-Bibliothek
#include "driverlib/ssi.h"
#ifdef DEBUG
void
__error__(char *pcFilename, unsigned long ulLine)
{
}
#endif
//Define ulProtocol data transfer protocol
#define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity
0,phase 0
#define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity
0,phase 1
#define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity
1,phase 0
#define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity
1,phase 1
#define SSI_FRF_TI 0x00000010 // TI frame format
#define SSI_FRF_NMW 0x00000020 // National MicroWire frame
#define SSI_ulBitRate 2000000
#define SSI_ulDataWidth 8
#define SSI_CS GPIO_PIN_3
#define SSI_CLK GPIO_PIN_2
#define SSI_TX GPIO_PIN_5
#define SSI_RX GPIO_PIN_4
int
main(void)
{
// Set the clocking to run directly from the crystal.
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC |
SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
// GPIO-Port_A aktivieren
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
// SSI0 aktiviren
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
//SSI_RX als Input
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_4);
//SSI_TX und SSI_CLK als Output
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_5);
//SSI_RX, SSI_TX, SSI_CLK an SSI übergeben
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4 |
GPIO_PIN_5);
// Configure the SSI.
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_NMW ,
SSI_MODE_MASTER, SSI_ulBitRate, SSI_ulDataWidth);
// Enable the SSI module.
SSIEnable(SSI0_BASE);
while(1)
{
}
}
Hallo Peter, Der Quelltext sieht okay aus. Den Startup-Code + Linkerscript benutzt du von den Beispielen und ist der richtige Controller eingestellt? Gruß Andreas
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.