After debugging, TRIG-OUT still does not output. See the attachment for the specific problem description. Hopes to provide complete chip running code. thank you!//
Problem description: 0x6141 can be read correctly when the chip ID is read after the device is powered on, and then the register is set according to page 19 of the document, but TIR_OUT pin does not output any signal. See attachment for code reference. struct reg_value_s step3_reg_values[] = { {0x07, 0x1011}, //TRIGGER_OUT {0x09, 0x7A4F}, //STARTUP2 {0x4D, 0x823F}, //STARTUP3 {0x54, 0x2AAA}, //STARTUP4 {0x56, 0x823F}, //STARTUP5 {0x5D, 0x2AAA}, //STARTUP6 {0x5F, 0x8FCC}, //STARTUP7 {0x60, 0x8FCC}, //STARTUP8 {0x61, 0x8FCC}, //STARTUP9 {0x62, 0x8FCC}, //STARTUP10 {0x63, 0x8FCC}, //STARTUP11 {0x64, 0x8FCC}, //STARTUP12 {0x65, 0x8FCC}, //STARTUP13 {0x66, 0x8FCC}, //STARTUP14 {0x81, 0x0001}, //STARTUP15 {0x83, 0x0840}, //STARTUP16 {0x84, 0xC201}, //STARTUP17 {0x73, 0x0000}, //SPI_DRV {0xff, 0xffff}//end flag }; struct reg_value_s step4_reg_values[] = { {0x90, 0x0420},//STARTUP18 {0x91, 0x87B4},//STARTUP19 {0xff, 0xffff}//end flag }; struct reg_value_s step5_reg_values[] = { {0x0D, 0x001F}, //CH0_AFE_EN {0x11, 0x001F}, //CH1_AFE_EN {0x15, 0x001F}, //CH2_AFE_EN {0x19, 0x001F}, //CH3_AFE_EN {0x1D, 0x001F}, //CH4_AFE_EN {0x21, 0x001F}, //CH5_AFE_EN {0x25, 0x001F}, //CH6_AFE_EN {0x29, 0x001F}, //CH7_AFE_EN {0x2D, 0x001F}, //CH8_AFE_EN {0x31, 0x001F}, //CH9_AFE_EN {0x35, 0x001F}, //CH10_AFE_EN {0x39, 0x001F}, //CH11_AFE_EN {0x3D, 0x001F}, //CH12_AFE_EN {0x41, 0x001F}, //CH13_AFE_EN {0x45, 0x001F}, //CH14_AFE_EN {0x49, 0x001F}, //CH15_AFE_EN {0x0F, 0x0200}, //CH0_STARTUP {0x13, 0x0200}, //CH1_STARTUP {0x17, 0x0200}, //CH2_STARTUP {0x1B, 0x0200}, //CH3_STARTUP {0x1F, 0x0200}, //CH4_STARTUP {0x23, 0x0200}, //CH5_STARTUP {0x27, 0x0200}, //CH6_STARTUP {0x2B, 0x0200}, //CH7_STARTUP {0x2F, 0x0200}, //CH8_STARTUP {0x33, 0x0200}, //CH9_STARTUP {0x37, 0x0200}, //CH10_STARTUP {0x3B, 0x0200}, //CH11_STARTUP {0x3F, 0x0200}, //CH12_STARTUP {0x43, 0x0200}, //CH13_STARTUP {0x47, 0x0200}, //CH14_STARTUP {0x4B, 0x0200}, //CH15_STARTUP {0xff, 0xffff}//end flag }; struct reg_value_s step6_reg_values[] = { {0x02, 0x1}, //STARTUP1 (Required) {0xE8, 0x1}, //STARTUP20 (Required) {0xff, 0xffff}//end flag }; struct reg_value_s step7_reg_values[] = { {0x4D, 0xC23F}, //STARTUP3 {0xB9, 0x0000}, //CONTROL_3 {0x05, 0xFFFF}, //CHx_EN {0xE4, 0xFFFF}, //CHx_AGC_EN {0xE5, 0xFFFF}, //CHx_DCB_EN {0xB9, 0x0001}, //CONTROL_3 {0xff, 0xffff}//end flag }; struct reg_value_s step8_reg_values[] = { {0x01, 0x1}, //SOFT_RESET {0x01, 0x0}, //SOFT_RESET release {0x01, 0x1}, //Set SYSTEM_READY {0x02, 0x8040}, //RUN_MODE //{0x02, 0x4040}, //RUN_TRIG {0xff, 0xffff}//end flag }; void hld16c_init_step(struct reg_value_s *reg_values) { int i = 0; uint16_t reg_v = 0; while(1){ if(reg_values[i].address == 0xff){ break; } #if SPI3_CHANNEL_ENABLE spi3_reg_single_write(reg_values[i].address, reg_values[i].data); #endif i++; } } void hld16c_init(void) { uint16_t reg0x92 = 0; uint16_t reg02 = 0; uint16_t regf5 = 0; uint16_t regf6 = 0; uint16_t spi3_sram_data[1600] = {0}; #if 0 spi3_read_id(); /*hard reset*/ gpio_bits_reset(GPIOD, GPIO_PINS_13); delay_ms(100); gpio_bits_set(GPIOD, GPIO_PINS_13); #endif //step2 wait 1ms delay_ms(1); hld16c_init_step(step3_reg_values); //step 4 wait for at leasst 100us fot the input clock delay_us(2*100); hld16c_init_step(step4_reg_values); /*wait for at least 100us, readback the TC_OUT bit(Address 92, Bit3), *and confirm the bit is set to 0x1 before proceeding to step 5. */ delay_ms(1); #if SPI3_CHANNEL_ENABLE while((reg0x92 == 0xffff) || ((reg0x92 & 0x8) == 0)) { //delay_us(2*100); delay_ms(1); reg0x92 = spi3_reg_single_read(0x92); } printf("hld16c spi3 init ok, reg92 = %#x\r\n", reg0x92); #endif hld16c_init_step(step5_reg_values); /*configure the LIDAR signal processor operating mode.*/ hld16c_init_step(step6_reg_values); /*enable the LIDAR signal processor channels*/ hld16c_init_step(step7_reg_values); delay_ms(1); /*start the finite state machine by issuing a soft reset command and *then starting the finite state machine*/ hld16c_init_step(step8_reg_values); #if SPI3_CHANNEL_ENABLE while(1){ regf6 = spi3_reg_single_read(0xf6); if(regf6 == 0){ delay_ms(1000); printf("sram not ready\r\n"); continue; } spi3_read_sram(spi3_sram_data, 1600); printf("%x, %x, %x, %x\r\n", spi3_sram_data[0], spi3_sram_data[1], spi3_sram_data[2], spi3_sram_data[3]); delay_ms(100); } #endif }
我们现在调试后依然是TRIG-OUT没输出,具体问题描述见附件。希望提供完整的芯片运行代码。谢谢!