cancel
Showing results for 
Search instead for 
Did you mean: 

No Output Voltage from TI DAC chip,with stm32F7

YShiw
Associate

Hi,there.I am using DAC60508 with my STM32F7,60508 is 12 bits precision,and with 24 bits command-length,SPI interface. After initialize the SPI,I send 3 bytes separately,and I use a oscilloscope to check the wave of SCL�?SDI�?CS,its seems right,but i cant detect any output votage. This SPI2 code demonstrated working with another thermal chip.

        static void MX_SPI2_Init(void)
         {
          LL_SPI_InitTypeDef SPI_InitStruct;
 
          LL_GPIO_InitTypeDef GPIO_InitStruct;
 
          /* Peripheral clock enable */
          LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2);
 
          /**SPI2 GPIO Configuration  
          PC2   ------> SPI2_MISO
          PC3   ------> SPI2_MOSI
          PB10   ------> SPI2_SCK 
          */
          GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
          GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
          GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
          GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
          GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
          GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
          LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
          GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
          GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
          GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
          GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
          GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
          GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
          LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
          GPIO_InitStruct.Pin = LL_GPIO_PIN_10;
          GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
          GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
          GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
          GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
          GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
          LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
          /* SPI2 parameter configuration*/
          SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
          SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
          SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
          SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
          SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE;
          SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
          SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV256;
          SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
          SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
          SPI_InitStruct.CRCPoly = 7;
          LL_SPI_Init(SPI2, &SPI_InitStruct);
 
        //  LL_SPI_SetStandard(SPI2, LL_SPI_PROTOCOL_MOTOROLA);
 
        //  LL_SPI_EnableNSSPulseMgt(SPI2);
 
        }
 
        LL_SPI_SetRxFIFOThreshold(SPI2, LL_SPI_RX_FIFO_TH_QUARTER );   
         while(1)
         {  
              LL_GPIO_ResetOutputPin(SPI2_NSS_GPIO_Port,SPI2_NSS_Pin); //CS
             SPI_SendByte(0x08);    //Output 0 Address       
             SPI_SendByte(0xff);    //Data MSB 8 bits
             SPI_SendByte(0xf0);    //Data LSB 4 bits
             delay_us(120);            
             LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port,SPI2_NSS_Pin);  // CS
             delay_ms(50);
         }
 
        unsigned char SPI_SendByte(unsigned char byte)
        {
            while(LL_SPI_IsActiveFlag_TXE(SPI2)==RESET);
          LL_SPI_TransmitData8(SPI2,byte);
 
        //  while(! (LL_SPI_IsActiveFlag_RXNE(SPI2)));
        //  return LL_SPI_ReceiveData8(SPI2);
        }

0690X0000088nakQAA.png

@Clive Two.Zero @Tilen MAJERLE @Community member​ 

@Piranha @raptorhal2

1 REPLY 1
YShiw
Associate

Problem solved,the reason maybe that i didnt initialize one of the registers​