Compare commits
2 Commits
61d1af0b1d
...
480f48e4b8
Author | SHA1 | Date |
---|---|---|
|
480f48e4b8 | |
|
e4c7841a5a |
|
@ -1,3 +1,127 @@
|
|||
<<<<<<< HEAD
|
||||
T6AE8 003:738.234 SEGGER J-Link V6.86f Log File
|
||||
T6AE8 003:738.282 DLL Compiled: Oct 23 2020 18:00:13
|
||||
T6AE8 003:738.289 Logging started @ 2025-03-08 05:43
|
||||
T6AE8 003:738.294 - 18.471ms
|
||||
T6AE8 003:738.304 JLINK_SetWarnOutHandler(...)
|
||||
T6AE8 003:738.309 - 0.007ms
|
||||
T6AE8 003:738.315 JLINK_OpenEx(...)
|
||||
T6AE8 003:739.849 Firmware: J-Link V9 compiled May 7 2021 16:26:12
|
||||
T6AE8 003:740.076 Decompressing FW timestamp took 189 us
|
||||
T6AE8 003:748.533 Hardware: V9.40
|
||||
T6AE8 003:748.553 S/N: 69401963
|
||||
T6AE8 003:748.560 OEM: SEGGER
|
||||
T6AE8 003:748.567 Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
|
||||
T6AE8 003:749.663 TELNET listener socket opened on port 19021
|
||||
T6AE8 003:753.535 WEBSRV Starting webserver
|
||||
T6AE8 003:753.666 WEBSRV Webserver running on local port 19080
|
||||
T6AE8 003:753.677 - 15.364ms returns "O.K."
|
||||
T6AE8 003:753.688 JLINK_GetEmuCaps()
|
||||
T6AE8 003:753.717 - 0.030ms returns 0xB9FF7BBF
|
||||
T6AE8 003:753.726 JLINK_TIF_GetAvailable(...)
|
||||
T6AE8 003:753.977 - 0.259ms
|
||||
T6AE8 003:753.993 JLINK_SetErrorOutHandler(...)
|
||||
T6AE8 003:753.998 - 0.007ms
|
||||
T6AE8 003:754.007 JLINK_ExecCommand("ProjectFile = "E:\ÎҵŤ×÷\004\02.ÏîÄ¿¹ÜÀí\BMSÏîÄ¿\00.Code\BCU_GIT_BLUESUN\BCU\app\stm32fxxx_app\prj\JLinkSettings.ini"", ...).
|
||||
T6AE8 003:754.843 - 0.855ms returns 0x00
|
||||
T6AE8 003:754.877 JLINK_ExecCommand("Device = STM32F407ZGTx", ...).
|
||||
T6AE8 003:755.413 Device "STM32F407ZG" selected.
|
||||
T6AE8 003:755.819 - 0.956ms returns 0x00
|
||||
T6AE8 003:755.873 JLINK_GetHardwareVersion()
|
||||
T6AE8 003:755.879 - 0.008ms returns 94000
|
||||
T6AE8 003:755.886 JLINK_GetDLLVersion()
|
||||
T6AE8 003:755.891 - 0.007ms returns 68606
|
||||
T6AE8 003:755.898 JLINK_GetOEMString(...)
|
||||
T6AE8 003:756.321 JLINK_GetFirmwareString(...)
|
||||
T6AE8 003:756.346 - 0.028ms
|
||||
T6AE8 003:756.357 JLINK_GetDLLVersion()
|
||||
T6AE8 003:756.362 - 0.007ms returns 68606
|
||||
T6AE8 003:756.368 JLINK_GetCompileDateTime()
|
||||
T6AE8 003:756.373 - 0.007ms
|
||||
T6AE8 003:756.381 JLINK_GetFirmwareString(...)
|
||||
T6AE8 003:756.386 - 0.007ms
|
||||
T6AE8 003:756.392 JLINK_GetHardwareVersion()
|
||||
T6AE8 003:756.397 - 0.007ms returns 94000
|
||||
T6AE8 003:756.404 JLINK_GetSN()
|
||||
T6AE8 003:756.409 - 0.007ms returns 69401963
|
||||
T6AE8 003:756.416 JLINK_GetOEMString(...)
|
||||
T6AE8 003:756.423 JLINK_TIF_Select(JLINKARM_TIF_SWD)
|
||||
T6AE8 003:757.193 - 0.777ms returns 0x00
|
||||
T6AE8 003:757.207 JLINK_HasError()
|
||||
T6AE8 003:757.214 JLINK_SetSpeed(5000)
|
||||
T6AE8 003:757.360 - 0.154ms
|
||||
T6AE8 003:757.657 JLINK_HasError()
|
||||
T6AE8 003:757.667 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL)
|
||||
T6AE8 003:757.673 - 0.007ms returns JLINKARM_RESET_TYPE_NORMAL
|
||||
T6AE8 003:757.679 JLINK_Reset()
|
||||
T6AE8 003:758.574 Found SW-DP with ID 0x2BA01477
|
||||
T6AE8 003:769.985 Found SW-DP with ID 0x2BA01477
|
||||
T6AE8 003:772.416 DPIDR: 0x2BA01477
|
||||
T6AE8 003:772.569 Scanning AP map to find all available APs
|
||||
T6AE8 003:773.077 AP[1]: Stopped AP scan as end of AP map has been reached
|
||||
T6AE8 003:773.087 AP[0]: AHB-AP (IDR: 0x24770011)
|
||||
T6AE8 003:773.095 Iterating through AP map to find AHB-AP to use
|
||||
T6AE8 003:773.917 AP[0]: Core found
|
||||
T6AE8 003:773.926 AP[0]: AHB-AP ROM base: 0xE00FF000
|
||||
T6AE8 003:774.286 CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
|
||||
T6AE8 003:774.296 Found Cortex-M4 r0p1, Little endian.
|
||||
T6AE8 003:875.382 -- Max. mem block: 0x00010E60
|
||||
T6AE8 003:875.474 CPU_ReadMem(4 bytes @ 0xE000EDF0)
|
||||
T6AE8 003:876.321 CPU_ReadMem(4 bytes @ 0xE0002000)
|
||||
T6AE8 003:876.917 FPUnit: 6 code (BP) slots and 2 literal slots
|
||||
T6AE8 003:876.981 CPU_ReadMem(4 bytes @ 0xE000EDFC)
|
||||
T6AE8 003:877.587 CPU_WriteMem(4 bytes @ 0xE000EDFC)
|
||||
T6AE8 003:878.216 CPU_ReadMem(4 bytes @ 0xE0001000)
|
||||
T6AE8 003:878.844 CPU_WriteMem(4 bytes @ 0xE0001000)
|
||||
T6AE8 003:879.462 CPU_ReadMem(4 bytes @ 0xE000ED88)
|
||||
T6AE8 003:880.075 CPU_WriteMem(4 bytes @ 0xE000ED88)
|
||||
T6AE8 003:880.674 CPU_ReadMem(4 bytes @ 0xE000ED88)
|
||||
T6AE8 003:881.228 CPU_WriteMem(4 bytes @ 0xE000ED88)
|
||||
T6AE8 003:881.882 CoreSight components:
|
||||
T6AE8 003:881.937 ROMTbl[0] @ E00FF000
|
||||
T6AE8 003:881.971 CPU_ReadMem(64 bytes @ 0xE00FF000)
|
||||
T6AE8 003:882.799 CPU_ReadMem(32 bytes @ 0xE000EFE0)
|
||||
T6AE8 003:883.534 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
|
||||
T6AE8 003:883.741 CPU_ReadMem(32 bytes @ 0xE0001FE0)
|
||||
T6AE8 003:884.317 ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
|
||||
T6AE8 003:884.373 CPU_ReadMem(32 bytes @ 0xE0002FE0)
|
||||
T6AE8 003:884.923 ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
|
||||
T6AE8 003:884.978 CPU_ReadMem(32 bytes @ 0xE0000FE0)
|
||||
T6AE8 003:885.572 ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
|
||||
T6AE8 003:885.626 CPU_ReadMem(32 bytes @ 0xE0040FE0)
|
||||
T6AE8 003:886.199 ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
|
||||
T6AE8 003:886.253 CPU_ReadMem(32 bytes @ 0xE0041FE0)
|
||||
T6AE8 003:886.824 ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
|
||||
T6AE8 003:887.083 CPU is running
|
||||
T6AE8 003:887.121 CPU_WriteMem(4 bytes @ 0xE000EDF0)
|
||||
T6AE8 003:887.541 CPU is running
|
||||
T6AE8 003:887.596 CPU_WriteMem(4 bytes @ 0xE000EDFC)
|
||||
T6AE8 003:888.048 Reset: Halt core after reset via DEMCR.VC_CORERESET.
|
||||
T6AE8 003:888.667 Reset: Reset device via AIRCR.SYSRESETREQ.
|
||||
T6AE8 003:888.723 CPU is running
|
||||
T6AE8 003:888.757 CPU_WriteMem(4 bytes @ 0xE000ED0C)
|
||||
T6AE8 003:941.348 CPU_ReadMem(4 bytes @ 0xE000EDF0)
|
||||
T6AE8 003:941.924 CPU_ReadMem(4 bytes @ 0xE000EDF0)
|
||||
T6AE8 003:942.490 CPU is running
|
||||
T6AE8 003:942.555 CPU_WriteMem(4 bytes @ 0xE000EDF0)
|
||||
T6AE8 003:943.161 CPU is running
|
||||
T6AE8 003:943.226 CPU_WriteMem(4 bytes @ 0xE000EDFC)
|
||||
T6AE8 003:949.811 CPU_ReadMem(4 bytes @ 0xE000EDF0)
|
||||
T6AE8 003:954.459 CPU_WriteMem(4 bytes @ 0xE0002000)
|
||||
T6AE8 003:955.078 CPU_ReadMem(4 bytes @ 0xE000EDFC)
|
||||
T6AE8 003:955.659 CPU_ReadMem(4 bytes @ 0xE0001000)
|
||||
T6AE8 003:956.254 - 198.608ms
|
||||
T6AE8 003:956.322 JLINK_GetId()
|
||||
T6AE8 003:956.803 - 0.513ms returns 0x2BA01477
|
||||
T6AE8 003:961.126 JLINK_GetFirmwareString(...)
|
||||
T6AE8 003:961.168 - 0.053ms
|
||||
T6AE8 046:760.610 JLINK_Close()
|
||||
T6AE8 046:760.995 CPU_ReadMem(4 bytes @ 0xE0001000)
|
||||
T6AE8 046:761.314 CPU_WriteMem(4 bytes @ 0xE0001004)
|
||||
T6AE8 046:773.538 - 12.946ms
|
||||
T6AE8 046:773.560
|
||||
T6AE8 046:773.567 Closed
|
||||
=======
|
||||
T9074 000:015.394 SEGGER J-Link V7.54d Log File
|
||||
T9074 000:015.506 DLL Compiled: Sep 28 2021 16:14:07
|
||||
T9074 000:015.512 Logging started @ 2025-03-01 08:00
|
||||
|
@ -1141306,3 +1141430,4 @@ T5050 2981:360.893 - 1.713ms returns FALSE
|
|||
T5050 2981:466.262 JLINK_HasError()
|
||||
T5050 2981:466.286 JLINK_IsHalted()
|
||||
T5050 2981:468.208 - 1.940ms returns FALSE
|
||||
>>>>>>> 61d1af0b1dc0ca34ce4763daa4ff9cf75720dd5c
|
||||
|
|
|
@ -11,57 +11,56 @@
|
|||
|
||||
void drv_set_ads8688_cs(GpioStatus state)
|
||||
{
|
||||
drv_gpio_set_pin_status(kGpioType_ADC_Cs, state);
|
||||
drv_gpio_set_pin_status(kGpioType_ADC_Cs, state);
|
||||
kit_time_dly_us(10);
|
||||
}
|
||||
|
||||
void drv_set_ads8688_rst(GpioStatus state)
|
||||
{
|
||||
drv_gpio_set_pin_status(kGpioType_ADC_Reset, state);
|
||||
drv_gpio_set_pin_status(kGpioType_ADC_Reset, state);
|
||||
}
|
||||
|
||||
uint8_t drv_ads8688_spi_send_rev(uint8_t data)
|
||||
{
|
||||
return drv_spi_sync_send_rev(kSpiDev_2, data);
|
||||
return drv_spi_sync_send_rev(kSpiDev_2, data);
|
||||
}
|
||||
|
||||
// 初始化ADS8688,并且检验读入寄存器数据和写入的是否一样
|
||||
// 返回TURE则说明初始化正常,否则错误
|
||||
// <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ADS8688<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>һ<EFBFBD><EFBFBD>
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>TURE<EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool drv_ads8688_Init(void)
|
||||
{
|
||||
uint8_t i = 0, value = 0;
|
||||
drv_spi_init(kSpiDev_2, kSpiFreq_Div256, kSpiMode_C0E1, SpiFrame_MSBFirst, kGpioType_ADC_Clk, kGpioType_ADC_Miso, kGpioType_ADC_Mosi);
|
||||
uint8_t i = 0, value = 0;
|
||||
drv_spi_init(kSpiDev_2, kSpiFreq_Div256, kSpiMode_C0E1, SpiFrame_MSBFirst, kGpioType_ADC_Clk, kGpioType_ADC_Miso, kGpioType_ADC_Mosi);
|
||||
// drv_ads8688_Reset();// hardware reset
|
||||
|
||||
drv_reset_ads8688();
|
||||
kit_time_dly_ms(20);
|
||||
|
||||
|
||||
drv_enter_standby_mode();
|
||||
kit_time_dly_ms(20);
|
||||
|
||||
//drv_enter_pwrdn_mode();
|
||||
//OSTimeDly(20);
|
||||
|
||||
drv_ads8688_write_reg(AUTO_SEQ_EN, 0xFF);
|
||||
kit_time_dly_ms(10);
|
||||
|
||||
|
||||
drv_enter_pwrdn_mode();
|
||||
kit_time_dly_ms(20);
|
||||
|
||||
drv_ads8688_write_reg(Feature_Select, 0x28);
|
||||
kit_time_dly_ms(20);
|
||||
|
||||
drv_set_ch_range(Channel_0_Input_Range,VREF_125_125);
|
||||
drv_set_ch_range(Channel_1_Input_Range,VREF_125_125);
|
||||
drv_set_ch_range(Channel_2_Input_Range,VREF_0625_0625);
|
||||
drv_set_ch_range(Channel_3_Input_Range,VREF_125_125);
|
||||
drv_set_ch_range(Channel_4_Input_Range,VREF_125_125);
|
||||
drv_set_ch_range(Channel_5_Input_Range,VREF_125_125);
|
||||
drv_set_ch_range(Channel_6_Input_Range,VREF_125_125);
|
||||
drv_set_ch_range(Channel_7_Input_Range,VREF_125_125);
|
||||
|
||||
//value = drv_ads8688_read_reg(Channel_0_Input_Range);
|
||||
|
||||
kit_time_dly_ms(20);
|
||||
|
||||
drv_set_ch_range(Channel_0_Input_Range, VREF_25_25);
|
||||
drv_set_ch_range(Channel_1_Input_Range, VREF_25_25);
|
||||
drv_set_ch_range(Channel_2_Input_Range, VREF_25_25);
|
||||
drv_set_ch_range(Channel_3_Input_Range, VREF_25_25);
|
||||
drv_set_ch_range(Channel_4_Input_Range, VREF_25_25);
|
||||
drv_set_ch_range(Channel_5_Input_Range, VREF_25_25);
|
||||
|
||||
drv_set_ch_pwrdn(0xC0);
|
||||
|
||||
|
||||
// value = drv_ads8688_read_reg(Channel_0_Input_Range);
|
||||
|
||||
drv_set_ch_pwrdn(0xC0);
|
||||
|
||||
//
|
||||
|
||||
#if ADC_AUTO_MODE
|
||||
|
||||
#if ADC_AUTO_MODE
|
||||
{
|
||||
drv_ads8688_write_reg(AUTO_SEQ_EN, 0x3F);
|
||||
i = drv_ads8688_read_reg(AUTO_SEQ_EN);
|
||||
|
@ -72,12 +71,12 @@ bool drv_ads8688_Init(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
drv_enter_auto_rst_mode(); // 进入自动扫描模式
|
||||
drv_enter_auto_rst_mode(); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ɨ<EFBFBD><EFBFBD>ģʽ
|
||||
OSTimeDly(20);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#else
|
||||
{
|
||||
drv_manual_chn_mode(MAN_Ch_0);
|
||||
drv_manual_chn_mode(MAN_Ch_1);
|
||||
|
@ -87,150 +86,146 @@ bool drv_ads8688_Init(void)
|
|||
drv_manual_chn_mode(MAN_Ch_5);
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void drv_ads8688_Reset(void) // hardware reset
|
||||
{
|
||||
uint8_t i = 5;
|
||||
drv_set_ads8688_rst(kGpioStatus_Low);
|
||||
uint8_t i = 5;
|
||||
drv_set_ads8688_rst(kGpioStatus_Low);
|
||||
OSTimeDly(10);
|
||||
while (i--)
|
||||
;
|
||||
drv_set_ads8688_rst(kGpioStatus_High);
|
||||
while (i--)
|
||||
;
|
||||
drv_set_ads8688_rst(kGpioStatus_High);
|
||||
}
|
||||
|
||||
void drv_ads8688_pwrdn(void) // hardware power-down
|
||||
{
|
||||
uint8_t i = 50;
|
||||
drv_set_ads8688_rst(kGpioStatus_Low);
|
||||
while (i--)
|
||||
;
|
||||
uint8_t i = 50;
|
||||
drv_set_ads8688_rst(kGpioStatus_Low);
|
||||
while (i--)
|
||||
;
|
||||
}
|
||||
|
||||
void drv_ads8688_pwrup(void) // power-down
|
||||
{
|
||||
drv_set_ads8688_rst(kGpioStatus_High);
|
||||
drv_set_ads8688_rst(kGpioStatus_High);
|
||||
}
|
||||
|
||||
|
||||
void drv_ads8688_write_cmd_reg(uint16_t command) // 写ADS8688命令寄存器
|
||||
void drv_ads8688_write_cmd_reg(uint16_t command) // дADS8688<38><38><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
{
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(command >> 8 & 0xFF);
|
||||
drv_ads8688_spi_send_rev(command & 0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(command >> 8 & 0xFF);
|
||||
drv_ads8688_spi_send_rev(command & 0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void drv_reset_ads8688(void) // 软件复位模式,复位 program registers
|
||||
void drv_reset_ads8688(void) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λģʽ<C4A3><CABD><EFBFBD><EFBFBD>λ program registers
|
||||
{
|
||||
drv_ads8688_write_cmd_reg(RST);
|
||||
drv_ads8688_write_cmd_reg(RST);
|
||||
}
|
||||
|
||||
// 进入STDBY模式,且命令发送后CS立刻置高,不读数据帧;
|
||||
// 退出此模式需执行AUTO_RST或者MAN_CH_n命令,且需要等待至少20us以保证正常数据的AD转换
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>STDBYģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD>CS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>øߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD>
|
||||
// <EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>AUTO_RST<EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAN_CH_n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20us<EFBFBD>Ա<EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ADת<EFBFBD><EFBFBD>
|
||||
void drv_enter_standby_mode(void)
|
||||
{
|
||||
//drv_ads8688_write_cmd_reg(STDBY);
|
||||
// drv_ads8688_write_cmd_reg(STDBY);
|
||||
drv_ads8688_write_cmd_reg(NO_OP);
|
||||
}
|
||||
|
||||
// 进入PWR_DN模式,且命令发送后CS立刻置高,不读数据帧;
|
||||
// 退出此模式需执行AUTO_RST或者MAN_CH_n命令,且需要等待至少15ms以保证正常数据的AD转换
|
||||
void drv_enter_pwrdn_mode(void) // 此为软件方式进入PWR_DN模式,与硬件方式区别是不改变 program registers
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>PWR_DNģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD>CS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>øߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD>
|
||||
// <EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>AUTO_RST<EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAN_CH_n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>15ms<EFBFBD>Ա<EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ADת<EFBFBD><EFBFBD>
|
||||
void drv_enter_pwrdn_mode(void) // <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>PWR_DNģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD>ı<EFBFBD> program registers
|
||||
{
|
||||
drv_ads8688_write_cmd_reg(PWR_DN);
|
||||
drv_ads8688_write_cmd_reg(PWR_DN);
|
||||
}
|
||||
|
||||
void drv_enter_auto_rst_mode(void) // 进入自动扫描模式
|
||||
void drv_enter_auto_rst_mode(void) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ɨ<EFBFBD><EFBFBD>ģʽ
|
||||
{
|
||||
drv_ads8688_write_cmd_reg(AUTO_RST);
|
||||
drv_ads8688_write_cmd_reg(AUTO_RST);
|
||||
}
|
||||
|
||||
// 读取扫描通道序列的AD转换数据code到变量数组中
|
||||
// <EFBFBD><EFBFBD>ȡɨ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ADת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>code<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void drv_enter_auto_rst_mode_Data(uint16_t *outputdata, uint8_t chnum)
|
||||
{
|
||||
uint8_t i = 0, datal = 0, datah = 0;
|
||||
uint16_t data = 0;
|
||||
for (i = 0; i < chnum; i++)
|
||||
{
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
datah = drv_ads8688_spi_send_rev(0xFF);
|
||||
datal = drv_ads8688_spi_send_rev(0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
uint8_t i = 0, datal = 0, datah = 0;
|
||||
uint16_t data = 0;
|
||||
for (i = 0; i < chnum; i++)
|
||||
{
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
datah = drv_ads8688_spi_send_rev(0xFF);
|
||||
datal = drv_ads8688_spi_send_rev(0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
|
||||
data = datah << 8 | datal; // 高位在前,低位在后
|
||||
*(outputdata + i) = data;
|
||||
}
|
||||
data = datah << 8 | datal; // <EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ں<EFBFBD>
|
||||
*(outputdata + i) = data;
|
||||
}
|
||||
}
|
||||
|
||||
void drv_manual_chn_mode(uint16_t ch) // 手动模式
|
||||
void drv_manual_chn_mode(uint16_t ch) // <EFBFBD>ֶ<EFBFBD>ģʽ
|
||||
{
|
||||
drv_ads8688_write_cmd_reg(ch);
|
||||
drv_ads8688_write_cmd_reg(ch);
|
||||
}
|
||||
|
||||
// 读取手动通道的AD转换数据code
|
||||
// <EFBFBD><EFBFBD>ȡ<EFBFBD>ֶ<EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ADת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>code
|
||||
uint16_t drv_manual_chn_mode_Data(void)
|
||||
{
|
||||
uint8_t datah = 0, datal = 0;
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
datah = drv_ads8688_spi_send_rev(0xFF);
|
||||
datal = drv_ads8688_spi_send_rev(0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
uint8_t datah = 0, datal = 0;
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
drv_ads8688_spi_send_rev(0x00);
|
||||
datah = drv_ads8688_spi_send_rev(0xFF);
|
||||
datal = drv_ads8688_spi_send_rev(0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
kit_time_dly_ms(10);
|
||||
return (datah << 8 | datal);
|
||||
return (datah << 8 | datal);
|
||||
}
|
||||
|
||||
//Gary add function
|
||||
// Gary add function
|
||||
uint16_t drv_get_ads8688_ch_data(uint16_t ch)
|
||||
{
|
||||
drv_manual_chn_mode(ch);
|
||||
return drv_manual_chn_mode_Data();
|
||||
}
|
||||
|
||||
// Program Register写操作
|
||||
// Program Registerд<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void drv_ads8688_write_reg(uint8_t Addr, uint8_t data)
|
||||
{
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(Addr << 1 | WRITE);
|
||||
drv_ads8688_spi_send_rev(data);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(Addr << 1 | WRITE);
|
||||
drv_ads8688_spi_send_rev(data);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
}
|
||||
|
||||
// Program Register读操作
|
||||
// Program Register<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t drv_ads8688_read_reg(uint8_t Addr)
|
||||
{
|
||||
uint8_t datah = 0,datal = 0;
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(Addr << 1 | READ);
|
||||
datah = drv_ads8688_spi_send_rev(0xFF);
|
||||
datal = drv_ads8688_spi_send_rev(0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
uint8_t datah = 0, datal = 0;
|
||||
drv_set_ads8688_cs(kGpioStatus_Low);
|
||||
drv_ads8688_spi_send_rev(Addr << 1 | READ);
|
||||
datah = drv_ads8688_spi_send_rev(0xFF);
|
||||
datal = drv_ads8688_spi_send_rev(0xFF);
|
||||
drv_set_ads8688_cs(kGpioStatus_High);
|
||||
|
||||
return datal + (datah << 8);
|
||||
return datal + (datah << 8);
|
||||
}
|
||||
|
||||
void drv_set_auto_scan_sequence(uint8_t seq) // 设置自动扫描序列通道
|
||||
void drv_set_auto_scan_sequence(uint8_t seq) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
|
||||
{
|
||||
drv_ads8688_write_reg(0x01, seq);
|
||||
drv_ads8688_write_reg(0x01, seq);
|
||||
}
|
||||
|
||||
void drv_set_ch_pwrdn(uint8_t chn) // 设置通道n为Power Down
|
||||
void drv_set_ch_pwrdn(uint8_t chn) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>nΪPower Down
|
||||
{
|
||||
drv_ads8688_write_reg(0X02, chn);
|
||||
|
||||
drv_ads8688_write_reg(0X02, chn);
|
||||
}
|
||||
|
||||
void drv_set_ch_range(uint8_t ch, uint8_t range) // 设置各个通道的范围
|
||||
void drv_set_ch_range(uint8_t ch, uint8_t range) // <EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD>Χ
|
||||
{
|
||||
drv_ads8688_write_reg(ch, range);
|
||||
drv_ads8688_write_reg(ch, range);
|
||||
kit_time_dly_ms(20);
|
||||
}
|
||||
|
||||
|
@ -239,7 +234,7 @@ int16_t drv_ads8688_value(uint16_t value)
|
|||
int32_t ret = 0;
|
||||
uint16_t tmp = 0;
|
||||
tmp = value & 0x7FFF;
|
||||
if(KIT_GET_BIT_VAL(value, 15) == 1)
|
||||
if (KIT_GET_BIT_VAL(value, 15) == 1)
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
|
@ -248,5 +243,3 @@ int16_t drv_ads8688_value(uint16_t value)
|
|||
return -tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -85,6 +85,8 @@ int drv_send_at_cmd2(const char *cmd, int delay_ms)
|
|||
|
||||
if (sim_item.buf_pos > 0 && strstr((const char*)sim_item.buf, "OK")) // 解析返回值
|
||||
{
|
||||
sim_item.buf_pos = 0;
|
||||
memset(sim_item.buf,0x00,MAX_RECV_LEN);
|
||||
return 1; // 成功
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,19 +24,21 @@ void drv_w5500_init(W5500Item *item, uint32_t ip, uint16_t *port_array, uint32_t
|
|||
uint32_t cnt = 0;
|
||||
|
||||
item->server_port = port_array;
|
||||
//自动协商 最高位置位,否则PHY重启
|
||||
buf[0] = 0x38 | 0x80 | 0x40;
|
||||
drv_w5500_write_comm_reg(item, W5500_PHYCFGR_REG_0x2E, buf, 1);
|
||||
|
||||
//初始化检测网线是否连接
|
||||
buf[0] = 0;
|
||||
while(((buf[0] & 0x01) == 0x00) && (cnt++ < 50))
|
||||
{
|
||||
bsp_task_delay_ms(100);
|
||||
drv_w5500_read_comm_reg(item, W5500_PHYCFGR_REG_0x2E, buf, 1);
|
||||
}
|
||||
|
||||
KIT_MODULE_PRINTF(W5500_PRT_EN, "w5500 connet res %d\r\n", cnt < 100);
|
||||
cnt = 0;
|
||||
|
||||
//自动协商 最高位置位,否则PHY重启
|
||||
buf[0] = 0x38 | 0x80 | 0x40;
|
||||
drv_w5500_write_comm_reg(item, W5500_PHYCFGR_REG_0x2E, buf, 1);
|
||||
|
||||
|
||||
//设置网关IP 子网掩码 MAC 源IP
|
||||
WRITE_LT_INT32U(buf, cnt, gateway_ip);
|
||||
WRITE_LT_INT32U(buf, cnt, net_mask);
|
||||
|
|
Loading…
Reference in New Issue