Forum: Mikrocontroller und Digitale Elektronik STM32 ,TDC GP22 antwortet nicht


von Mark (Gast)


Angehängte Dateien:

Lesenswert?

Hallo,

ich bekomme leider keine Verbindung zum TCD GP22 aufgebaut.
Beim Senden einer Initialisierungsroutine sollte der Chip eigentlich mit 
einem Interrupt reagieren was er aber nicht macht. Ich habe das SPI 
Protokoll mal mit einem Logic Analyzer beobachtet, die MOSI Daten werden 
denke ich richtig übertragen.

Vll hat ja jmd hier im Forum mal mit dem Chip gearbeitet und kann mir 
helfen.


Ich verwende einen STM32f103rb.

Vielen Dank

Mark

von pegel (Gast)


Lesenswert?

Sicher, dass das Chip Select zwischendurch H sein darf?
Das funktioniert meist nicht.

von Stefan F. (Gast)


Lesenswert?

Vielleicht gibt es dort eine Diskrepanz ob die Daten bei der steigenden 
oder fallenden Flanke vom Takt übernommen werden sollen.

von Mark (Gast)


Lesenswert?

Also an dem Code habe ich nur die Pins angepasst für das Nucleo Bord.
Ansonsten ist das der Originale vom Hersteller. Desswegen denke ich das 
das so sein muss.
1
 void gp22_wr_config_reg (void *bus_type, uint8_t opcode_address,
2
                         uint32_t config_reg_data)
3
{
4
   uint8_t Data_Byte_Lo    = config_reg_data;
5
   uint8_t Data_Byte_Mid1  = config_reg_data>>8;
6
   uint8_t Data_Byte_Mid2  = config_reg_data>>16;
7
   uint8_t Data_Byte_Hi    = config_reg_data>>24;
8
9
   uint8_t common_delay    = 0; // important delay (16) at SPI freq.=750kHz
10
11
      // Deactivating Reset SPIx
12
      if (bus_type==SPI1) GPIO_WriteBit(GPIOA, GPIO_Pin_4, Bit_RESET);
13
      if (bus_type==SPI2) GPIO_WriteBit(GPIOB, GPIO_Pin_12, Bit_RESET);
14
15
      while (SPI_I2S_GetFlagStatus(bus_type, SPI_I2S_FLAG_TXE)==0) {}
16
17
      SPI_I2S_SendData(bus_type, opcode_address);  // RAM WR OPCODE+ADDRESS
18
  Simple_delay_750ns((void*)common_delay);
19
20
      while (SPI_I2S_GetFlagStatus(bus_type, SPI_I2S_FLAG_TXE)==0) {}
21
      SPI_I2S_SendData(bus_type, Data_Byte_Hi);  // DATA BYTE HIGH
22
  Simple_delay_750ns((void*)common_delay);
23
24
      while (SPI_I2S_GetFlagStatus(bus_type, SPI_I2S_FLAG_TXE)==0) {}
25
       SPI_I2S_SendData(bus_type, Data_Byte_Mid2);  // DATA MID - 2
26
  Simple_delay_750ns((void*)common_delay);
27
28
      while (SPI_I2S_GetFlagStatus(bus_type, SPI_I2S_FLAG_TXE)==0) {}
29
       SPI_I2S_SendData(bus_type, Data_Byte_Mid1);  // DATA MID - 1
30
  Simple_delay_750ns((void*)common_delay);
31
32
      while (SPI_I2S_GetFlagStatus(bus_type, SPI_I2S_FLAG_TXE)==0) {}
33
       SPI_I2S_SendData(bus_type, Data_Byte_Lo);  // DATA LOW
34
  Simple_delay_750ns((void*)common_delay);
35
36
      while (SPI_I2S_GetFlagStatus(bus_type, SPI_I2S_FLAG_TXE)==0) {}
37
  Simple_delay_750ns((void*)common_delay);
38
39
     // Reset to device SPIx
40
     if (bus_type==SPI1) GPIO_WriteBit(GPIOA, GPIO_Pin_4, Bit_SET);
41
     if (bus_type==SPI2) GPIO_WriteBit(GPIOB, GPIO_Pin_12, Bit_SET);
42
}

von Mark (Gast)


Lesenswert?

Hier nochmal ein Auszug aus dem Datenblatt


SSN as Reset
The SerialSelectNot (SSN) line is the HIGH-active reset for the serial 
interface. After SSN
is set to LOW different operations can be addressed, not depending on 
the status of the
interface before the reset.
Note:
It is mandatory to set the SSN – line to High-state for at least 50 ns 
between each
Read-/Write sequence.

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
Noch kein Account? Hier anmelden.