Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem max32630fthr USBDevice
Revision 1:7530b7eb757a, committed 2020-05-28
- Comitter:
- china_sn0w
- Date:
- Thu May 28 02:30:39 2020 +0000
- Parent:
- 0:5a9619496af2
- Child:
- 2:3a8f285d261a
- Commit message:
- V1.1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AVDD_CONFIG.cpp Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "max32630fthr.h"
+#include "USBSerial.h"
+#include "I2CSlave.h"
+
+#define MCP4561_ADDR 0x5C
+
+
+extern I2C i2c_v;
+
+void SetVoltageAVDD(float vol)
+{
+ uint8_t r_value = 0;
+ uint8_t buf[2];
+ r_value = 256 - 27/(vol/1.235 - 1.0)/50*256;
+
+ buf[0] = 0x40;
+ buf[1] = 0x0E;
+ i2c_v.write(MCP4561_ADDR, (char*)buf, 2);
+
+ buf[0] = 0x00;
+ buf[1] = r_value;
+ i2c_v.write(MCP4561_ADDR, (char*)buf, 2);
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AVDD_CONFIG.h Thu May 28 02:30:39 2020 +0000 @@ -0,0 +1,15 @@ +#ifndef _AVDD_CONFIG_ +#define _AVDD_CONFIG_ + +#include "mbed.h" +#include "max32630fthr.h" +#include "USBSerial.h" +#include "I2CSlave.h" + +void SetVoltageAVDD(float vol); + + +#endif + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CmdHandler.cpp Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,393 @@
+#include "mbed.h"
+#include "cmsis_os.h"
+#include "max32630fthr.h"
+#include "USBSerial.h"
+#include "CmdHandler.h"
+
+#include "DUT_RegConfig.h"
+//#include "Config.h"
+#include "ServoRun.h"
+
+GLOBAL_CMD_VAR g_cmd;
+
+//extern CONFIG g_config;
+extern DUTREG dut_reg[DUT_REG_NUM];
+extern uint8_t histogram[10][1024];
+extern uint8_t histogram_mode;
+extern uint8_t histogram_tdc;
+extern uint8_t Firmware[8192];
+extern uint8_t dcr_matrix[17][9*2];
+
+uint8_t _uart_send_pbuff[CMD_BUF_LEN] = {0x00};
+
+uint8_t UserTxBufferFS[2048];
+
+uint8_t sys_cfg_save = 0;
+
+//extern Queue<uint8_t, 2048> cmd_queue;
+extern USBSerial microUSB;
+extern DigitalOut rLED;
+extern DigitalOut xSHUT;
+extern InterruptIn chip_int;
+
+extern uint16_t histogram_pos_num;
+extern uint16_t histogram_per_pos;
+
+void CmdHandleTask(void)
+{
+ uint8_t ret;
+ uint16_t i=0;
+ uint8_t uart_val = 0;
+ uint16_t _pbuff_len = 0;
+
+ while(1) {
+ ret = microUSB.buf.dequeue(&uart_val);
+ if(ret == 1) {
+ if(g_cmd.valid_flag == 0) { //None Header
+ if(uart_val == 0x5A) { //Already find header
+ g_cmd.valid_flag = 1;
+ i=0;
+ g_cmd.buf[i++] = uart_val;
+ } else {
+ i=0;
+ }
+ } else if(g_cmd.valid_flag == 1) { //已经找到了帧头
+ if(i < CMD_BUF_LEN) {
+ g_cmd.buf[i++] = uart_val;
+ if(i>=4) { //根据协议长度区判断接收的协议帧大小
+ _pbuff_len = ((g_cmd.buf[3]&0x00ff)<<8) + g_cmd.buf[2];
+ if(i == (_pbuff_len+5)) { //一包结束
+ g_cmd.package_len = i;
+ DealUart1OnePackage(g_cmd.buf, g_cmd.package_len);
+ i = 0;
+ g_cmd.valid_flag = 0;
+ continue;
+ } else if((_pbuff_len+5)>=CMD_BUF_LEN) {
+ i = 0;
+ g_cmd.valid_flag = 0;
+ continue;
+ }
+ }
+ } else {
+ i = 0;
+ g_cmd.valid_flag = 0;;
+ }
+ }
+ } else {
+ i = 0;
+ g_cmd.valid_flag = 0;
+ wait_ms(50);
+ //osDelay(50);
+ }
+ }
+
+}
+
+uint8_t Check_Sum(uint8_t *_pbuff, uint16_t _cmdLen)
+{
+ uint8_t cmd_sum=0;
+ uint16_t i;
+
+ for(i=0; i<_cmdLen; i++) {
+ cmd_sum += _pbuff[i];
+ }
+ cmd_sum = (~cmd_sum);
+
+ return cmd_sum;
+}
+
+//协议相关命令的发送
+void UART_CmdAckSend(uint8_t ack_cmd, uint8_t register_addr, uint8_t *pbuff, uint16_t pbuff_len)
+{
+ while(g_cmd.send_flag == 1) {
+ wait_ms(50);
+ }
+
+ g_cmd.send_flag = 1;
+
+ UserTxBufferFS[0] = 0x5a;
+ UserTxBufferFS[1] = 0x00;
+ uint16_t i=1, j=0;
+ uint16_t _uart_pbuff_len = 0;
+
+ _uart_pbuff_len = pbuff_len+1;
+ UserTxBufferFS[i++]= ack_cmd;
+ UserTxBufferFS[i++]= (_uart_pbuff_len&0x00ff);
+ UserTxBufferFS[i++]= (_uart_pbuff_len>>8);
+ UserTxBufferFS[i++]= register_addr;
+ for(j=0; j<pbuff_len; j++) {
+ UserTxBufferFS[i++] = pbuff[j];
+ }
+ UserTxBufferFS[i++] = Check_Sum(&UserTxBufferFS[1], _uart_pbuff_len+3);
+
+ uint16_t k = 0;
+
+ while(i > 64) {
+ microUSB.writeBlock(&UserTxBufferFS[k], 64);
+ i -= 64;
+ k += 64;
+ }
+ microUSB.writeBlock(&UserTxBufferFS[k], i);
+ g_cmd.send_flag = 0;
+}
+
+
+void DealUart1OnePackage(uint8_t *pd, uint16_t cmdLen)
+{
+ uint16_t _pd_len = 0;
+
+ _pd_len = ((pd[3]&0x00ff)<<8) + pd[2];
+
+ if(pd[_pd_len+4] != Check_Sum(&pd[1],_pd_len+3)) { //校验不正确,直接返回
+ return;
+ }
+
+ switch(pd[4]) {
+ case REGISTER_CMD: //寄存器操作
+ if(pd[1] == 0x00) { //读
+ //rLED = LED_ON;
+ if(HandleReadReg() == 0)
+ UART_CmdAckSend(READ_CMD | 0x80, REGISTER_CMD, _uart_send_pbuff, DUT_REG_NUM*2);
+ else
+ UART_CmdAckSend(READ_CMD | 0x10, REGISTER_CMD, _uart_send_pbuff, 2);
+ } else if(pd[1] == 0x01) { //写
+ //rLED = LED_OFF;
+ if(HandleWriteReg(pd, cmdLen) == 0)
+ UART_CmdAckSend(WRITE_CMD | 0x80, REGISTER_CMD, _uart_send_pbuff, 2);
+ else
+ UART_CmdAckSend(WRITE_CMD | 0x10, REGISTER_CMD, _uart_send_pbuff, 2);
+ }
+ break;
+
+ case VAN_SINGLE_MEAS:// 单次测量
+ if(HandleOneTimeMeasure() == 0)
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_SINGLE_MEAS, _uart_send_pbuff, 4);
+ else
+ UART_CmdAckSend(READ_CMD | 0x10, VAN_SINGLE_MEAS, _uart_send_pbuff, 2);
+ break;
+
+ case VAN_CONTIU_MEAS:// 连续测量
+ if(HandleContinuousMeasure(pd) == 0)
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_CONTIU_MEAS, _uart_send_pbuff, 2);
+ else
+ UART_CmdAckSend(READ_CMD | 0x10, VAN_CONTIU_MEAS, _uart_send_pbuff, 2);
+ break;
+
+ case VAN_READ_HIST_CMD://读取Histogram
+ if(pd[5] == 0xF0)
+ {
+ WriteOneReg(REG_SYS_CFG, sys_cfg_save);
+ histogram_mode = 0;
+ }
+ else if(pd[5] == 0xF1)
+ {
+ ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ WriteOneReg(REG_SYS_CFG, 0x01);
+ histogram_mode = 2;
+ }
+ else if(pd[5] == 0xF2)
+ {
+ ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ WriteOneReg(REG_SYS_CFG, 0x01);
+ histogram_mode = 4;
+ }
+ else
+ {
+ ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ WriteOneReg(REG_SYS_CFG, 0x01);
+ histogram_mode = 1;
+ histogram_tdc = pd[5];
+ }
+
+ break;
+ case VAN_STEP_HISTOGRAM_CMD:
+ if(pd[5] == 0xF0) {
+ WriteOneReg(REG_SYS_CFG, sys_cfg_save);
+ histogram_mode = 0;
+ } else if(pd[5] == 0xF1) {
+ ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ WriteOneReg(REG_SYS_CFG, 0x01);
+ histogram_mode = 3;
+ histogram_pos_num = pd[6] + pd[7]*256;
+ histogram_per_pos = pd[8] + pd[9]*256;
+ }
+ break;
+
+ case VAN_MOVING_CTL_CMD:
+ ServoRun(pd[5], pd[6] + pd[7]*256);
+ break;
+
+ case VAN_DOWN_FW_CMD:
+ if(HandleDownloadFW(pd, cmdLen) == 0)
+ UART_CmdAckSend(WRITE_CMD | 0x80, VAN_DOWN_FW_CMD, _uart_send_pbuff, 2);
+ else
+ UART_CmdAckSend(WRITE_CMD | 0x10, VAN_DOWN_FW_CMD, _uart_send_pbuff, 2);
+ break;
+
+ case CHIP_RST_CMD:
+ HandleChipReset();
+ break;
+
+ case CHIP_EN_CMD:
+ //HandleChipEnable(pd[5]);
+ break;
+
+ case INT_ENABLE_CMD:
+ if(pd[5] == 1)
+ chip_int.disable_irq();
+ break;
+
+ case VAN_DCR_TEST_CMD:
+ if(DCRTest(pd[5], pd[6]) == 0)
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_DCR_TEST_CMD, (uint8_t*)dcr_matrix, 17*9*2);
+ else
+ UART_CmdAckSend(READ_CMD | 0x10, VAN_DCR_TEST_CMD, _uart_send_pbuff, 2);
+ break;
+
+ case VAN_DELAYLINE_TEST_CMD:
+ if(DelayLineTest(pd[5], _uart_send_pbuff) == 0)
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_DELAYLINE_TEST_CMD, _uart_send_pbuff, 144);
+ else
+ UART_CmdAckSend(READ_CMD | 0x10, VAN_DELAYLINE_TEST_CMD, _uart_send_pbuff, 2);
+ break;
+
+ case VAN_GET_TDC_PHASE_CMD:
+ if(GetTdcPhase(_uart_send_pbuff) == 0)
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_GET_TDC_PHASE_CMD, _uart_send_pbuff, 2);
+ else
+ UART_CmdAckSend(READ_CMD | 0x10, VAN_GET_TDC_PHASE_CMD, _uart_send_pbuff, 2);
+ break;
+
+ default:
+
+ break;
+ }
+
+}
+
+
+uint8_t HandleWriteReg(uint8_t *pd, uint16_t cmdLen)
+{
+ uint16_t _pd_len = 0;
+ uint16_t reg_num = 0;
+
+ _pd_len = ((pd[3]&0x00ff)<<8) + pd[2];
+
+ reg_num = (_pd_len - 1)/2;
+
+ for(uint16_t i = 0; i < reg_num; i++) {
+ //dut_reg[pd[5+2*i]].value = pd[5+2*i+1];
+ WriteOneReg(pd[5+2*i], pd[5+2*i+1]);
+ }
+
+ return 0;
+}
+
+uint8_t HandleReadReg(void)
+{
+ uint8_t ret = 0;
+
+ ret = ReadAllRegToTable();
+ if(ret == 0) {
+ memcpy(_uart_send_pbuff, &dut_reg, DUT_REG_NUM*2);
+ }
+
+ return ret;
+}
+
+uint8_t HandleOneTimeMeasure(void)
+{
+ return OneTimeMeasure((uint16_t*)_uart_send_pbuff, (uint16_t*)(_uart_send_pbuff + 2));
+}
+
+uint8_t HandleContinuousMeasure(uint8_t *pd)
+{
+ if(pd[5] == 0x00)
+ return StopContinuousMeasure();
+ else
+ return ContinuousMeasure();
+}
+
+uint8_t HandleReadHistogram(uint8_t tdc_idx)
+{
+ _uart_send_pbuff[0] = tdc_idx;
+
+ memcpy(&_uart_send_pbuff[1], histogram[tdc_idx], 1024);
+
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_READ_HIST_CMD, _uart_send_pbuff, 1025);
+ return 0;
+}
+
+uint8_t HandleDownloadFW(uint8_t *pd, uint16_t cmdLen)
+{
+ static uint8_t pkg_num = 0;
+ uint8_t ret = 0;
+ uint8_t pkg_idx = pd[5];
+ uint16_t pkg_len = ((pd[3]&0x00ff)<<8) + pd[2] - 2;
+ static uint16_t pkg_saved = 0;
+
+ if(pkg_idx == 0) { //第一包固件
+ printf("Fist Pkg of FW arrived.\n");
+ memset(Firmware, 0x00, 8192);
+ pkg_num = 0;
+ pkg_saved = 0;
+
+ memcpy(Firmware + pkg_saved, &pd[6], pkg_len);
+ pkg_num++;
+ pkg_saved += pkg_len;
+ } else if(pkg_idx == 0xF0) {
+ printf("Last Pkg of FW arrived. Begin to Download to Chip.\n");
+ //DebugArray(Firmware, pkg_saved);//For Debug
+ ret = WriteFW(pkg_saved);
+ } else if(pkg_idx == 0xF1) {
+ printf("Firmware transmission has been halt.\n");
+ memset(Firmware, 0x00, 8192);
+ pkg_num = 0;
+ pkg_saved = 0;
+ } else {
+ memcpy(Firmware + pkg_saved, &pd[6], pkg_len);
+ pkg_num++;
+ pkg_saved += pkg_len;
+ }
+
+ if(ret == 0) {
+ printf("Firmware download successfully.\n");
+ }
+
+ _uart_send_pbuff[0] = pkg_idx;
+
+ return ret;
+}
+
+uint8_t HandleContinuousMeasureReport(uint16_t lsb, uint16_t milimeter)
+{
+ memcpy(_uart_send_pbuff, &lsb, 2);
+ memcpy(_uart_send_pbuff + 2, &milimeter, 2);
+
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_CONTIU_MEAS, _uart_send_pbuff, 4);
+
+ return 0;
+}
+
+void HandleChipReset(void)
+{
+ xSHUT = 0;
+ wait_ms(30);
+ xSHUT = 1;
+}
+
+void HandleFreqReport(float* V_I_Value)
+{
+ uint32_t temp_byte = 0;
+
+ _uart_send_pbuff[0] = 0;
+ _uart_send_pbuff[1] = 0;
+ memset(&_uart_send_pbuff[2], 0x00, 11);
+
+ for(uint8_t i = 0; i < 10; i++) {
+ temp_byte = V_I_Value[i];
+ memcpy(_uart_send_pbuff + 13 + 4*i, &temp_byte, 4);
+ }
+
+ UART_CmdAckSend(READ_CMD | 0x80, FREQ_REPORT, _uart_send_pbuff, 53);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CmdHandler.h Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,105 @@
+#ifndef _CMD_HANDLER_
+#define _CMD_HANDLER_
+
+#include "mbed.h"
+#include "max32630fthr.h"
+#include "USBSerial.h"
+
+#define CMD_QUEUE_LEN 2048
+#define CMD_BUF_LEN 2048
+
+typedef struct cmd_global {
+ uint8_t one_package_done;
+ uint8_t valid_flag;
+ uint8_t send_flag;
+ uint16_t package_len;
+ uint8_t buf[CMD_BUF_LEN];
+ //uint8_t
+
+} GLOBAL_CMD_VAR;
+
+#define UPDATA_CMD 0x06
+#define UPDATA_CMD_ACK 0x86
+
+#define UPDATA_DATA_CMD 0x07
+#define UPDATA_DATA_CMD_ACK 0x87
+
+#define WRITE_CMD 0x01 //写
+#define WRITE_CMD_ACK 0x81
+
+#define READ_CMD 0x00 //读
+#define READ_CMD_ACK 0x80
+#define READ_ERROR_CMD_ACK 0X10
+
+#define SPI_AUTO_TRANSF_CMD 0x03 //SPI数据主动上传
+#define MEASURE_AUTO_TRANSF_CMD 0x07
+
+#define REGISTER_CMD 0x01 //寄存器操作命令
+#define CHUCHANG_SET_CMD 0x02 //出厂设置
+#define CHUCHANG_SET_RESET_CMD 0x03 //恢复出厂设置
+#define DISTANCE_OFFSET_CALIBRATION_CMD 0x04 //距离offset校准命令
+#define GAOFAN_OFFSET_CALIBRATION_CMD 0x05 //高反offset校准命令
+#define LSB_REALDISTANCE_CHANGE 0x06 //LSB 真实距离切换
+#define SINGLE_COLLECT 0x07 //单次采集
+#define CONTINUE_COLLECT 0x08 //连续采集 开始/停止
+#define HISTORGRAM_READ 0x09 // Historgram读取
+#define RAWDATA_READ 0x0A // RawData读取
+#define SPI_DATA_TRANSF_SHUANGFENG 0x0B //SPI TOF PEAK上传
+#define SPI_DATA_TRANSF_DANFENG 0x0C //SPI TOF PEAK上传
+#define REGISTER_CONTROL_CMD 0x0D //寄存器直接读写操作
+#define HISTOGRAM_READ_CASSATT 0x0E //CASSATT芯片读取Histogram
+#define SINGLE_PIXEL_CMD 0x0F //单PIXEL模式PEKA值读取
+#define DELAYLINE_TEST_CMD 0x11 //单PIXEL模式PEKA值读取
+
+#define SWITCH_CMD 0x40
+#define MEASURE_CALI_CMD 0x41
+#define TC_GPIO_CMD 0x42
+#define MCU_OSC_OUT_CMD 0x43
+#define INT_ENABLE_CMD 0x44
+#define CHIP_RST_CMD 0x45
+#define CHIP_EN_CMD 0x46
+#define FREQ_REPORT 0x47
+
+#define VAN_SCRATCH_CMD 0x50
+#define VAN_RAW_REG_CMD 0x51
+#define VAN_AVDD_CMD 0x53
+#define VAN_HISTOGRAM 0x54
+#define VAN_RANGE_CMD 0x55
+#define VAN_DOWN_FW_CMD 0x56
+#define VAN_READ_HIST_CMD 0x57
+#define VAN_SINGLE_MEAS 0x58
+#define VAN_CONTIU_MEAS 0x59
+#define VAN_STEP_HISTOGRAM_CMD 0x5A
+#define VAN_MOVING_CTL_CMD 0x5B
+#define VAN_DCR_TEST_CMD 0x5C
+#define VAN_DELAYLINE_TEST_CMD 0x5D
+#define VAN_GET_TDC_PHASE_CMD 0x5E
+
+
+
+
+
+void CmdHandleTask(void);
+
+void DealUart1OnePackage(uint8_t *pd, uint16_t cmdLen);
+
+uint8_t HandleWriteReg(uint8_t *pd, uint16_t cmdLen);
+uint8_t HandleReadReg(void);
+uint8_t HandleOneTimeMeasure(void);
+uint8_t HandleContinuousMeasure(uint8_t *pd);
+uint8_t HandleReadHistogram(uint8_t tdc_idx);
+uint8_t HandleDownloadFW(uint8_t *pd, uint16_t cmdLen);
+uint8_t HandleContinuousMeasureReport(uint16_t lsb, uint16_t milimeter);
+
+uint8_t HandleSwitch(uint8_t *pd, uint16_t cmdLen);
+void HandleChipReset(void);
+void HandleChipEnable(uint8_t en);
+void HandleInterruptEnable(uint8_t en);
+
+void HandleFreqReport(float* V_I_Value);
+
+void UART_CmdAckSend(uint8_t ack_cmd, uint8_t register_addr, uint8_t *pbuff, uint16_t pbuff_len);
+
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/DUT_RegConfig.cpp Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,555 @@
+#include "mbed.h"
+#include "cmsis_os.h"
+#include "max32630fthr.h"
+#include "USBSerial.h"
+#include "CmdHandler.h"
+#include "DUT_RegConfig.h"
+#include "ServoRun.h"
+#include "SDFileSystem.h"
+#include "Firmware.h"
+#include "RegTable.h"
+#include "CmdHandler.h"
+
+DUTREG dut_reg[DUT_REG_NUM];
+uint8_t Firmware[8192];
+uint8_t histogram[10][1024];
+uint8_t dcr_matrix[17][9*2];
+
+uint8_t int_mark = 0;
+uint8_t int_enable = 1;
+uint8_t histogram_mode = 0;
+uint8_t histogram_tdc = 0;
+
+Semaphore chip_int_semph(1);
+extern DigitalOut xSHUT;
+extern I2C i2c_v;
+
+uint16_t histogram_pos_num = 0;
+uint16_t histogram_per_pos = 0;
+
+extern const uint8_t reg_table[];
+extern const uint8_t Firmware_Ranging[];
+extern uint8_t _uart_send_pbuff[CMD_BUF_LEN] ;
+
+void ChipInitReset(void)
+{
+ xSHUT = 0;
+ wait_ms(30);
+ xSHUT = 1;
+}
+
+void DUT_RegInit(void)
+{
+ LoadRegTable();
+ for(uint16_t i = 0; i < 256; i++) {
+ //WriteOneReg(dut_reg[i].addr, dut_reg[i].value);
+ dut_reg[i].addr = i;
+ dut_reg[i].value = 0x00;
+ }
+}
+
+
+void DUT_FirmwareInit(void)
+{
+ WriteFW(LoadFirmware());
+}
+
+void Enable_DUT_Interrupt(void)
+{
+ int_enable = 1;
+}
+
+void Disable_DUT_Interrupt(void)
+{
+ int_enable = 0;
+}
+
+void InterruptHandle(void)
+{
+ if(int_enable == 0)
+ return;
+
+ if(int_mark == 1) {
+ int_mark = 0;
+ } else if(int_mark == 2) {
+ chip_int_semph.release();
+ //发送信号量
+ }
+}
+
+void HistogramReport()
+{
+ uint8_t ret = 0;
+ uint16_t lsb, mili;
+
+
+ uint16_t histogram_pos = 0;
+ uint16_t histogram_num = 0;
+ while(1) {
+ if(histogram_mode == 1) {
+ //ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ //WriteOneReg(REG_SYS_CFG, 0x00);
+ ret = OneTimeMeasure(&lsb, &mili);
+ if(ret != 0) {
+ histogram_mode = 0;
+ } else {
+ ret = vangogh_ram_rd(histogram_tdc);
+ if(ret != 0) {
+ histogram_mode = 0;
+ } else {
+ HandleReadHistogram(histogram_tdc);
+ }
+ }
+ //WriteOneReg(REG_SYS_CFG, sys_cfg_save);
+ } else if(histogram_mode == 2) {
+ //ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ //WriteOneReg(REG_SYS_CFG, 0x00);
+ ret = OneTimeMeasure(&lsb, &mili);
+ if(ret != 0) {
+ histogram_mode = 0;
+ } else {
+ for(uint8_t i = 0; i < 10; i++) {
+ ret = vangogh_ram_rd(i);
+ if(ret != 0) {
+ histogram_mode = 0;
+ break;
+ } else {
+ HandleReadHistogram(i);
+ wait_ms(1);
+ }
+ }
+ }
+ //WriteOneReg(REG_SYS_CFG, sys_cfg_save);
+ } else if(histogram_mode == 3) {
+
+
+ if(histogram_num >= histogram_per_pos) {
+ histogram_num = 0;
+ histogram_pos++;
+ if(histogram_pos >= histogram_pos_num) {
+ histogram_mode = 0;
+ }
+ ServoRun(1, 10);
+ while(CheckUntil()) wait_ms(100);
+ }
+ //ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ //WriteOneReg(REG_SYS_CFG, 0x00);
+ ret = OneTimeMeasure(&lsb, &mili);
+ if(ret != 0) {
+ histogram_mode = 0;
+ } else {
+ for(uint8_t i = 0; i < 10; i++) {
+ ret = vangogh_ram_rd(i);
+ if(ret != 0) {
+ histogram_mode = 0;
+ break;
+ } else {
+ StoreHistogram(histogram_pos, histogram_num, i);
+ wait_ms(100);
+ }
+ }
+ }
+ //WriteOneReg(REG_SYS_CFG, sys_cfg_save);
+ histogram_num++;
+ } else if(histogram_mode == 4) {
+ //ReadOneReg(REG_SYS_CFG, &sys_cfg_save);
+ //WriteOneReg(REG_SYS_CFG, 0x00);
+ ret = OneTimeMeasure(&lsb, &mili);
+ if(ret != 0) {
+ histogram_mode = 0;
+ } else {
+ for(uint8_t i = 0; i < 9; i++) {
+ ret = vangogh_ram_rd(i);
+ if(ret != 0) {
+ histogram_mode = 0;
+ break;
+ } else {
+ HandleReadHistogram(i);
+ wait_ms(1);
+ }
+ }
+ }
+ //WriteOneReg(REG_SYS_CFG, sys_cfg_save);
+ }else {
+ histogram_num = 0;
+ histogram_pos = 0;
+ histogram_pos_num = 0;
+ histogram_per_pos = 0;
+ }
+ wait(1);
+ }
+}
+
+void ContinuousMeasureReport()
+{
+ uint16_t lsb, milimeter;
+ uint8_t int_flag = 0;
+ uint16_t time_out = 0;
+
+ while(1) {
+
+ chip_int_semph.wait();
+
+ if(RaadContinuousMeasure(&lsb, &milimeter) == 0) {
+ HandleContinuousMeasureReport(lsb, milimeter);
+ }
+
+ }
+}
+
+uint8_t WriteOneReg(uint8_t addr, uint8_t data)
+{
+ uint8_t buf[2];
+ buf[0] = addr;
+ buf[1] = data;
+
+ i2c_v.write(DUT_DEV_ADDR, (char*)buf, 2);
+
+ return 0;
+}
+
+uint8_t ReadOneReg(uint8_t addr, uint8_t *data)
+{
+ uint8_t buf[2];
+ buf[0] = addr;
+
+ i2c_v.write(DUT_DEV_ADDR, (char*)buf, 1);
+ i2c_v.read (DUT_DEV_ADDR, (char*)data, 1);
+
+ return 0;
+}
+
+
+uint8_t ReadAllRegToTable(void)
+{
+ for(uint16_t i = 0; i < DUT_REG_NUM; i++) {
+ ReadOneReg(dut_reg[i].addr, &(dut_reg[i].value));
+ }
+
+ return 0;
+}
+
+uint8_t WriteFW(uint16_t size)
+{
+ uint8_t ret = 0;
+ uint8_t i;
+ uint8_t reg_sys_cfg;
+ uint8_t uart_rx_data;
+ uint16_t fw_size = size;
+ uint16_t fw_send = 0;
+
+ ret = WriteOneReg(REG_PW_CTRL, 0x08);
+ ret = WriteOneReg(REG_PW_CTRL, 0x0a);
+ ret = WriteOneReg(REG_MCU_CFG, 0x02);
+ ret = ReadOneReg (REG_SYS_CFG, ®_sys_cfg);
+ ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg | (0x01<<0));
+ ret = WriteOneReg(REG_CMD, 0x01);
+ ret = WriteOneReg(REG_SIZE, 0x02);
+ ret = WriteOneReg(REG_SCRATCH_PAD_BASE+0x00, 0x00);
+ ret = WriteOneReg(REG_SCRATCH_PAD_BASE+0x01, 0x00);
+
+ while(fw_size >= 32) {
+ ret = WriteOneReg(REG_CMD,0x03);
+ ret = WriteOneReg(REG_SIZE,0x20);
+ for(i=0; i<32; i++) {
+ uart_rx_data = Firmware[fw_send++];
+ ret = WriteOneReg(REG_SCRATCH_PAD_BASE+i, uart_rx_data);
+ wait_us(5);
+ }
+ fw_size -= 32;
+ }
+ if(fw_size > 0) {
+ ret = WriteOneReg(REG_CMD,0x03);
+ ret = WriteOneReg(REG_SIZE,(uint8_t)fw_size);
+ for(i=0; i<fw_size; i++) {
+ uart_rx_data = Firmware[fw_send++];
+ ret = WriteOneReg(REG_SCRATCH_PAD_BASE+i, uart_rx_data);
+ wait_us(5);
+ }
+ }
+ ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg & ~(0x01<<0));
+ ret = WriteOneReg(REG_MCU_CFG, 0x03);
+ ret = WriteOneReg(REG_PW_CTRL, 0x02); //reset r_otp_ld_done, is a must
+ ret = WriteOneReg(REG_PW_CTRL, 0x00); //reset r_otp_ld_done, exit low power mode
+
+ return ret;
+}
+
+uint8_t vangogh_ram_rd(uint8_t tdc) //UART CMD foramt: CMD-1-byte|TDC-index-1-byte
+{
+ uint8_t ret = 0;
+ uint8_t i;
+ uint8_t j;
+ uint8_t reg_pw_ctrl;
+ uint8_t reg_sys_cfg;
+ uint8_t tdc_index = tdc;
+ uint16_t ram_addr_base = 0x1000 + 0x0400 * tdc_index;
+
+ ret = ReadOneReg (REG_SYS_CFG, ®_sys_cfg );
+ ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg | (0x01<<0));
+ ret = ReadOneReg (REG_PW_CTRL, ®_pw_ctrl);
+ ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<3)); //set otp_ld_done
+ ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<3) | (0x01<<1)); //set otp_ld_done, pw_ctrl_lp
+ ret = WriteOneReg(REG_CMD, 0x01);
+ ret = WriteOneReg(REG_SIZE, 0x02);
+ ret = WriteOneReg(REG_SCRATCH_PAD_BASE+0x00, *((uint8_t*)(&ram_addr_base) ));
+ ret = WriteOneReg(REG_SCRATCH_PAD_BASE+0x01, *((uint8_t*)(&ram_addr_base)+1));
+ wait_us(100);
+ for(j=0; j<32; j++) {
+ ret = WriteOneReg(REG_CMD,0x05); //Issue RAM read command
+ ret = WriteOneReg(REG_SIZE,0x20); //Issue RAM read command
+ wait_us(100);
+ for(i=0; i<32; i++) {
+ ret = ReadOneReg(0x0c+i, &histogram[tdc_index][32*j + i]);
+ }
+ }
+ ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg & ~(0x01<<0)); //clear sc_en
+ ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<1)); //restore power control register
+ ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl & ~(0x01<<1)); //clear pw_ctrl_lp
+
+ return ret;
+}
+
+uint8_t OneTimeMeasure(uint16_t *lsb, uint16_t *milimeter)
+{
+ uint8_t ret = 0;
+ uint8_t reg_pw_ctrl;
+ uint8_t reg_sys_cfg;
+ uint32_t timeout = 0;
+
+ int_mark = 1;//One Time Measure
+
+ //ret = ReadOneReg (REG_SYS_CFG, ®_sys_cfg );
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg | (0x01<<0));
+ //ret = ReadOneReg (REG_PW_CTRL, ®_pw_ctrl);
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<3)); //set otp_ld_done
+ //ret = WriteOneReg(REG_PW_CTRL, (reg_pw_ctrl | (0x01<<3)) & ~(0x01<<1)); //set otp_ld_done, clear pw_ctrl_lp
+ ret = WriteOneReg(REG_CMD, 0x0E);
+ //ret = WriteOneReg(REG_SIZE, 0x00);
+
+ timeout = 1000;
+ while(int_mark == 1 && timeout != 0) {
+ timeout--;
+ wait_ms(5);
+ }
+
+ if(timeout == 0) {
+ return 1;
+
+ } else {
+
+ ret = ReadOneReg(0x0d, (uint8_t*)lsb);
+ ret = ReadOneReg(0x0e, (uint8_t*)lsb + 1);
+
+ ret = ReadOneReg(0x18, (uint8_t*)milimeter);
+ ret = ReadOneReg(0x19, (uint8_t*)milimeter + 1);
+
+ }
+
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg & ~(0x01<<0)); //clear sc_en
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<1)); //restore power control register
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl & ~(0x01<<1)); //clear pw_ctrl_lp
+
+ return ret;
+}
+
+uint8_t ContinuousMeasure(void)
+{
+ uint8_t ret = 0;
+ uint8_t reg_pw_ctrl;
+ uint8_t reg_sys_cfg;
+
+ int_mark = 2;//Continuous Time Measure
+
+ //ret = ReadOneReg (REG_SYS_CFG, ®_sys_cfg );
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg | (0x01<<0));
+ //ret = ReadOneReg (REG_PW_CTRL, ®_pw_ctrl);
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<3)); //set otp_ld_done
+ //ret = WriteOneReg(REG_PW_CTRL, (reg_pw_ctrl | (0x01<<3)) & ~(0x01<<1)); //set otp_ld_done, clear pw_ctrl_lp
+ ret = WriteOneReg(REG_CMD, 0x0F);
+ //ret = WriteOneReg(REG_SIZE, 0x00);
+
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg & ~(0x01<<0)); //clear sc_en
+
+ return ret;
+}
+
+uint8_t RaadContinuousMeasure(uint16_t *lsb, uint16_t *milimeter)
+{
+ uint8_t ret = 0;
+ uint8_t reg_pw_ctrl;
+ uint8_t reg_sys_cfg;
+
+ int_mark = 2;//Continuous Time Measure
+
+ //ret = ReadOneReg (REG_SYS_CFG, ®_sys_cfg );
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg | (0x01<<0));
+ //ret = ReadOneReg (REG_PW_CTRL, ®_pw_ctrl);
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<3)); //set otp_ld_done
+ //ret = WriteOneReg(REG_PW_CTRL, (reg_pw_ctrl | (0x01<<3)) & ~(0x01<<1)); //set otp_ld_done, clear pw_ctrl_lp
+
+ ret = ReadOneReg(0x0d, (uint8_t*)lsb);
+ ret = ReadOneReg(0x0e, (uint8_t*)lsb + 1);
+
+ ret = ReadOneReg(0x18, (uint8_t*)milimeter);
+ ret = ReadOneReg(0x19, (uint8_t*)milimeter + 1);
+
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg & ~(0x01<<0)); //clear sc_en
+
+ return ret;
+}
+
+uint8_t StopContinuousMeasure()
+{
+ uint8_t ret = 0;
+ uint8_t reg_pw_ctrl;
+ uint8_t reg_sys_cfg;
+
+ int_mark = 0;//Continuous Time Measure
+
+ //ret = ReadOneReg (REG_SYS_CFG, ®_sys_cfg );
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg | (0x01<<0));
+ //ret = ReadOneReg (REG_PW_CTRL, ®_pw_ctrl);
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<3)); //set otp_ld_done
+ //ret = WriteOneReg(REG_PW_CTRL, (reg_pw_ctrl | (0x01<<3)) & ~(0x01<<1)); //set otp_ld_done, clear pw_ctrl_lp
+ ret = WriteOneReg(REG_CMD, 0x00);
+ ret = WriteOneReg(REG_SIZE, 0x00);
+
+ //ret = WriteOneReg(REG_SYS_CFG, reg_sys_cfg & ~(0x01<<0)); //clear sc_en
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl | (0x01<<1)); //restore power control register
+ //ret = WriteOneReg(REG_PW_CTRL, reg_pw_ctrl & ~(0x01<<1)); //clear pw_ctrl_lp
+
+ return ret;
+}
+
+void StoreHistogram(uint16_t histogram_pos, uint16_t histogram_num, uint8_t tdc)
+{
+ /*
+ char file_name[20];
+
+ //sprintf(file_name, "/sd/hist_%d_%d_tdc%d", histogram_pos, histogram_num, tdc);
+ sprintf(file_name, "/sd/hello.txt");
+
+ FILE *fp = fopen(file_name, "w");
+ //for(uint32_t i = 0; i < 1024; i++) {
+ // fseek(fp,0,SEEK_END);
+ // fprintf(fp, "%02X ", histogram[tdc][i]);
+ //}
+ fprintf(fp, "hello ");
+
+ fflush(fp);
+ fclose(fp);
+ */
+
+ _uart_send_pbuff[0] = histogram_pos;
+ _uart_send_pbuff[1] = histogram_pos >> 8;
+
+ _uart_send_pbuff[2] = tdc;
+
+ _uart_send_pbuff[3] = histogram_num;
+ _uart_send_pbuff[4] = histogram_num >> 8;
+
+ memcpy(&_uart_send_pbuff[5], histogram[tdc], 1024);
+
+ UART_CmdAckSend(READ_CMD | 0x80, VAN_STEP_HISTOGRAM_CMD, _uart_send_pbuff, 1024 + 1 + 2 + 2);
+ //return 0;
+}
+
+uint8_t DCRTest(uint8_t vspad, uint8_t test_time)
+{
+ uint8_t ret = 0;
+ uint32_t timeout = 0;
+ memset(dcr_matrix, 0x00, 17*9*2);
+ WriteOneReg(0x50, 0x01);
+ WriteOneReg(0xBD, 0x01);
+ wait_ms(100);
+ WriteOneReg(0xD8, 0xF0);
+
+ for(uint8_t group = 0; group < 9; group++) {
+ WriteOneReg(0x0C, group);
+ wait_ms(1);
+ WriteOneReg(0x0D, test_time);
+ wait_ms(1);
+
+ timeout = 25;
+ int_mark = 1;
+ WriteOneReg(0x0A, 0x0C);
+ while(int_mark == 1 && timeout != 0) {
+ timeout--;
+ wait_ms(100);
+ }
+ //osDelay(80);
+ for(uint8_t pix = 0; pix < 17; pix++) {
+ ret = ReadOneReg(0x82 + pix*2, &dcr_matrix[pix][group*2 + 1]);
+ ret = ReadOneReg(0x82 + pix*2 + 1, &dcr_matrix[pix][group*2]);
+ //osDelay(1);
+ if(ret != 0)
+ return ret;
+ }
+
+ }
+
+ return 0;
+}
+
+uint8_t DelayLineTest(uint8_t phase, uint8_t* buf)
+{
+ uint8_t ret = 0;
+ uint32_t timeout = 0;
+
+ WriteOneReg(0xE4, phase);
+ wait_ms(10);
+
+ for(uint8_t step = 0; step < 8; step++) {
+ WriteOneReg(0xE1, 0x61 | (step << 1));
+ wait_ms(10);
+
+ timeout = 50;
+ int_mark = 1;
+ WriteOneReg(0x0A, 0x0B);
+ wait_ms(10);
+ while(int_mark == 1 && timeout != 0) {
+ timeout--;
+ wait_ms(100);
+ }
+ for(uint8_t tdc = 0; tdc < 9; tdc++) {
+ ret = ReadOneReg(0x0c + tdc*2, buf + step*18 + tdc*2 + 1);
+ wait_ms(1);
+ ret = ReadOneReg(0x0c + tdc*2 + 1, buf + step*18 + tdc*2);
+ wait_ms(1);
+ }
+
+ }
+
+ return 0;
+}
+
+uint8_t GetTdcPhase(uint8_t* buf)
+{
+ uint8_t ret = 0;
+ uint32_t timeout = 0;
+ memset(buf, 0x00, 10);
+
+ WriteOneReg(0x0C, 0x0C);
+ WriteOneReg(0x0A, 0x0A);
+ wait_ms(1);
+
+ timeout = 10;
+ int_mark = 1;
+ WriteOneReg(0x0A, 0x0B);
+ while(int_mark == 1 && timeout != 0) {
+ timeout--;
+ wait_ms(100);
+ }
+ //osDelay(80);
+
+ ret = ReadOneReg(0x0D, buf);
+ ret = ReadOneReg(0xE4, buf + 1);
+
+ if(ret != 0)
+ return ret;
+
+ return 0;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/DUT_RegConfig.h Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,62 @@
+#ifndef __DUT_REGCONFIG__
+#define __DUT_REGCONFIG__
+
+#include "mbed.h"
+#include "cmsis_os.h"
+#include "max32630fthr.h"
+
+#define DUT_DEV_ADDR 0xD8
+
+#define DUT_REG_NUM 256
+
+#define REG_MCU_CFG 0x00
+#define REG_SYS_CFG 0x01
+#define REG_PW_CTRL 0x07
+#define REG_CMD 0x0a
+#define REG_SIZE 0x0b
+#define REG_SCRATCH_PAD_BASE 0x0c
+#define REG_INTEG_CNT_L 0x45
+#define REG_INTEG_CNT_M 0x46
+#define REG_INTEG_CNT_H 0x47
+#define REG_RANGING_CTRL 0x50
+#define REG_RANGING_ANA_CTRL 0xbd
+
+
+typedef struct DUTREG
+{
+ uint8_t addr;
+ uint8_t value;
+}DUTREG;
+
+void DUT_FirmwareInit(void);
+void ChipInitReset(void);
+void DUT_RegInit(void);
+void Enable_DUT_Interrupt(void);
+void Disable_DUT_Interrupt(void);
+void InterruptHandle(void);
+
+void ContinuousMeasureReport();
+void HistogramReport();
+
+uint8_t WriteOneReg(uint8_t addr, uint8_t data);
+uint8_t ReadOneReg(uint8_t addr, uint8_t *data);
+uint8_t ReadAllRegToTable(void);
+uint8_t WriteFW(uint16_t size);
+uint8_t vangogh_ram_rd(uint8_t tdc);
+uint8_t OneTimeMeasure(uint16_t *lsb, uint16_t *milimeter);
+uint8_t ContinuousMeasure(void);
+uint8_t RaadContinuousMeasure(uint16_t *lsb, uint16_t *milimeter);
+uint8_t StopContinuousMeasure(void);
+uint8_t DCRTest(uint8_t vspad, uint8_t test_time);
+uint8_t DelayLineTest(uint8_t phase, uint8_t* buf);
+uint8_t GetTdcPhase(uint8_t* buf);
+
+
+
+void StoreHistogram(uint16_t histogram_pos, uint16_t histogram_num, uint8_t tdc);
+
+#endif
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Firmware.cpp Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,217 @@
+
+/* Created by Protons Binary To 'C' Converter V1.00 */
+#include "Firmware.h"
+
+extern uint8_t Firmware[8192];
+
+const uint8_t Firmware_Ranging[] =
+{
+ 0x02,0x00,0x06,0x02,0x0b,0xb3,0x78,0x3f,0xe4,0xf6,0xd8,0xfd,0x75,0x81,0xbf,0x02,
+ 0x00,0x66,0x00,0x02,0x09,0xd5,0xe4,0xfd,0xfc,0xc3,0xed,0x9f,0xec,0x9e,0x50,0x18,
+ 0xe4,0xfb,0xfa,0x00,0x00,0x00,0x0b,0xbb,0x00,0x01,0x0a,0xba,0x05,0xf5,0xbb,0xd1,
+ 0xf2,0x0d,0xbd,0x00,0x01,0x0c,0x80,0xe1,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x02,0x0b,0x58,0x00,0x00,0x00,0x00,0x00,0x02,0x08,0x06,0x00,0x00,
+ 0x00,0x00,0x00,0x02,0x09,0x19,0x00,0x00,0x00,0x00,0x00,0x02,0x05,0x10,0x00,0x00,
+ 0x00,0x00,0x00,0x02,0x0a,0x73,0x75,0x2a,0x40,0x75,0xff,0x01,0x7d,0x0c,0x7c,0x00,
+ 0x7f,0x07,0x12,0x0c,0x5e,0xe4,0xf5,0x26,0xe5,0x26,0x24,0x0c,0xff,0xe5,0x26,0x24,
+ 0x01,0xfd,0xe4,0x33,0xfc,0x12,0x0c,0x5e,0x05,0x26,0xe5,0x26,0xc3,0x94,0x20,0x40,
+ 0xe7,0xe4,0x78,0x2f,0xf6,0x08,0x76,0x01,0xfb,0x12,0x0c,0x3f,0x75,0x88,0x05,0x75,
+ 0xe8,0x1e,0x75,0xa8,0x86,0x78,0x31,0xe6,0x64,0x09,0x60,0x03,0x02,0x01,0x73,0xf6,
+ 0xfb,0x7a,0x00,0x79,0x28,0x7f,0x0c,0x12,0x0c,0x45,0x7d,0x05,0x7c,0x00,0x7f,0xa4,
+ 0x12,0x0c,0x5e,0x7d,0x01,0x7f,0x50,0x12,0x0c,0x23,0xe5,0x28,0xb4,0x0f,0x00,0x40,
+ 0x03,0x02,0x01,0x63,0x90,0x00,0xdb,0xf8,0x28,0x28,0x73,0x02,0x01,0x08,0x02,0x01,
+ 0x0c,0x02,0x01,0x12,0x02,0x01,0x18,0x02,0x01,0x1e,0x02,0x01,0x24,0x02,0x01,0x2a,
+ 0x02,0x01,0x30,0x02,0x01,0x36,0x02,0x01,0x3c,0x02,0x01,0x45,0x02,0x01,0x4b,0x02,
+ 0x01,0x51,0x02,0x01,0x57,0x02,0x01,0x5d,0x7f,0x7d,0x80,0x02,0x7f,0xfa,0x7e,0x00,
+ 0x80,0x2e,0x7f,0xf4,0x7e,0x01,0x80,0x28,0x7f,0xe8,0x7e,0x03,0x80,0x22,0x7f,0xd0,
+ 0x7e,0x07,0x80,0x1c,0x7f,0xa0,0x7e,0x0f,0x80,0x16,0x7f,0x40,0x7e,0x1f,0x80,0x10,
+ 0x7f,0x80,0x7e,0x3e,0x80,0x0a,0x7f,0x00,0x7e,0x7d,0x80,0x04,0x7f,0x00,0x7e,0xfa,
+ 0x12,0x0c,0x2a,0x80,0x25,0x7f,0x80,0x7e,0x00,0x80,0x1c,0x7f,0x00,0x7e,0x01,0x80,
+ 0x16,0x7f,0x00,0x7e,0x02,0x80,0x10,0x7f,0x00,0x7e,0x04,0x80,0x0a,0x7f,0x00,0x7e,
+ 0x08,0x80,0x04,0x7f,0x00,0x7e,0x02,0x12,0x00,0x16,0x7d,0x04,0x7c,0x00,0x7f,0xa4,
+ 0x02,0x04,0xe6,0x78,0x31,0xe6,0x64,0x0a,0x60,0x03,0x02,0x02,0x59,0xf6,0xfb,0x7a,
+ 0x00,0x79,0x29,0x7f,0xe4,0x12,0x0c,0x45,0x53,0x29,0xc0,0x78,0x2c,0xe6,0xb4,0x10,
+ 0x00,0x40,0x03,0x02,0x02,0x33,0x90,0x01,0x9d,0xf8,0x28,0x28,0x73,0x02,0x01,0xcd,
+ 0x02,0x01,0xd3,0x02,0x01,0xd9,0x02,0x01,0xdf,0x02,0x01,0xe5,0x02,0x01,0xeb,0x02,
+ 0x01,0xf1,0x02,0x01,0xf7,0x02,0x01,0xfd,0x02,0x02,0x03,0x02,0x02,0x09,0x02,0x02,
+ 0x0f,0x02,0x02,0x15,0x02,0x02,0x1b,0x02,0x02,0x21,0x02,0x02,0x27,0xe5,0x29,0x54,
+ 0x01,0x80,0x58,0xe5,0x29,0x54,0x02,0x80,0x52,0xe5,0x29,0x54,0x04,0x80,0x4c,0xe5,
+ 0x29,0x54,0x08,0x80,0x46,0xe5,0x29,0x54,0x11,0x80,0x40,0xe5,0x29,0x54,0x12,0x80,
+ 0x3a,0xe5,0x29,0x54,0x14,0x80,0x34,0xe5,0x29,0x54,0x18,0x80,0x2e,0xe5,0x29,0x54,
+ 0x21,0x80,0x28,0xe5,0x29,0x54,0x22,0x80,0x22,0xe5,0x29,0x54,0x24,0x80,0x1c,0xe5,
+ 0x29,0x54,0x28,0x80,0x16,0xe5,0x29,0x54,0x31,0x80,0x10,0xe5,0x29,0x54,0x32,0x80,
+ 0x0a,0xe5,0x29,0x54,0x34,0x80,0x04,0xe5,0x29,0x54,0x38,0xfd,0x7c,0x00,0x7f,0xe4,
+ 0x12,0x0c,0x5e,0x78,0x2c,0x06,0x7d,0x01,0x7c,0x00,0x7f,0xbd,0x12,0x0c,0x5e,0x7f,
+ 0x50,0x12,0x0c,0x5e,0x7d,0x10,0x7f,0x45,0x12,0x0c,0x5e,0xe4,0xfd,0x12,0x0c,0x22,
+ 0x7d,0x07,0x7c,0x00,0x7f,0x50,0x02,0x04,0xe6,0x78,0x31,0xe6,0xfb,0x64,0x0b,0x70,
+ 0x26,0xf6,0x78,0x2d,0x76,0x01,0x7d,0x01,0xfc,0x7f,0xbd,0x12,0x0c,0x5e,0x7f,0x50,
+ 0x12,0x0c,0x5e,0x7d,0x40,0x7f,0x45,0x12,0x0c,0x5e,0xfd,0x12,0x0c,0x22,0x7d,0xc7,
+ 0x7c,0x00,0x7f,0x50,0x02,0x04,0xe6,0xeb,0x64,0x0c,0x60,0x03,0x02,0x04,0xa3,0x78,
+ 0x31,0xf6,0xf5,0x26,0xe5,0x26,0x24,0xc2,0xff,0xe4,0xfd,0xfc,0x12,0x0c,0x5e,0x05,
+ 0x26,0xe5,0x26,0xc3,0x94,0x12,0x40,0xec,0xe4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,0x03,0x87,0xf8,0x28,0x28,0x73,0x02,0x03,0xb4,0x02,0x03,0xb8,0x02,0x03,0xbe,
+ 0x02,0x03,0xc4,0x02,0x03,0xca,0x02,0x03,0xd0,0x02,0x03,0xd6,0x02,0x03,0xdc,0x02,
+ 0x03,0xe2,0x02,0x03,0xe8,0x02,0x03,0xf1,0x02,0x03,0xf7,0x02,0x03,0xfd,0x02,0x04,
+ 0x03,0x02,0x04,0x09,0x7f,0x7d,0x80,0x02,0x7f,0xfa,0x7e,0x00,0x80,0x2e,0x7f,0xf4,
+ 0x7e,0x01,0x80,0x28,0x7f,0xe8,0x7e,0x03,0x80,0x22,0x7f,0xd0,0x7e,0x07,0x80,0x1c,
+ 0x7f,0xa0,0x7e,0x0f,0x80,0x16,0x7f,0x40,0x7e,0x1f,0x80,0x10,0x7f,0x80,0x7e,0x3e,
+ 0x80,0x0a,0x7f,0x00,0x7e,0x7d,0x80,0x04,0x7f,0x00,0x7e,0xfa,0x12,0x0c,0x2a,0x80,
+ 0x25,0x7f,0x80,0x7e,0x00,0x80,0x1c,0x7f,0x00,0x7e,0x01,0x80,0x16,0x7f,0x00,0x7e,
+ 0x02,0x80,0x10,0x7f,0x00,0x7e,0x04,0x80,0x0a,0x7f,0x00,0x7e,0x08,0x80,0x04,0x7f,
+ 0x00,0x7e,0x02,0x12,0x00,0x16,0xe5,0x27,0xb4,0x0a,0x00,0x50,0x76,0x90,0x04,0x24,
+ 0xf8,0x28,0x28,0x73,0x02,0x04,0x42,0x02,0x04,0x49,0x02,0x04,0x50,0x02,0x04,0x57,
+ 0x02,0x04,0x5e,0x02,0x04,0x65,0x02,0x04,0x6c,0x02,0x04,0x73,0x02,0x04,0x7a,0x02,
+ 0x04,0x86,0xe4,0xfd,0xfc,0x7f,0xc2,0x80,0x36,0xe4,0xfd,0xfc,0x7f,0xc4,0x80,0x2f,
+ 0xe4,0xfd,0xfc,0x7f,0xc6,0x80,0x28,0xe4,0xfd,0xfc,0x7f,0xc8,0x80,0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2,
+ 0x10,0x75,0xa3,0x00,0x75,0xa4,0x00,0x75,0xa5,0x00,0x75,0xa9,0x00,0x75,0xaa,0x00,
+ 0x75,0xab,0x00,0x75,0xbe,0x00,0x75,0xbf,0x00,0x75,0xc2,0x10,0x75,0xc3,0x11,0x75,
+ 0xc4,0x01,0x75,0xc5,0x00,0x75,0xc6,0x00,0x75,0xc7,0x00,0x75,0xa1,0x01,0x75,0xa1,
+ 0x00,0x80,0x21,0x75,0xd2,0x02,0x75,0xd3,0x00,0x75,0xd4,0x10,0x75,0xd5,0x00,0x75,
+ 0xd6,0x14,0x75,0xd7,0x00,0x75,0xd9,0x00,0x75,0xda,0x00,0x75,0xd1,0x01,0x75,0xd1,
+ 0x00,0x78,0x2f,0x06,0x7d,0x07,0x7c,0x00,0x7f,0xbd,0x12,0x0c,0x5e,0xe4,0xfd,0x7f,
+ 0x50,0x12,0x0c,0x5e,0xd0,0x93,0xd0,0x94,0xd0,0x07,0xd0,0x06,0xd0,0x05,0xd0,0x04,
+ 0xd0,0x03,0xd0,0x02,0xd0,0x01,0xd0,0x00,0xd0,0xd0,0xd0,0x86,0xd0,0x84,0xd0,0x85,
+ 0xd0,0x82,0xd0,0x83,0xd0,0xf0,0xd0,0xe0,0x32,0xc0,0xe0,0xc0,0xf0,0xc0,0x83,0xc0,
+ 0x82,0xc0,0x85,0xc0,0x84,0xc0,0x86,0x75,0x86,0x00,0xc0,0xd0,0x75,0xd0,0x00,0xc0,
+ 0x00,0xc0,0x01,0xc0,0x02,0xc0,0x03,0xc0,0x04,0xc0,0x05,0xc0,0x06,0xc0,0x07,0xc0,
+ 0x94,0xc0,0x93,0x53,0x91,0xbf,0x78,0x2f,0xe6,0xff,0xc3,0x94,0x08,0x50,0x21,0x75,
+ 0xd4,0x00,0x75,0xd5,0x00,0xef,0x25,0xe0,0x25,0xe0,0x24,0x14,0xf5,0xd6,0x75,0xd7,
+ 0x00,0x75,0xd9,0x00,0x75,0xda,0x00,0x75,0xd1,0x01,0x75,0xd1,0x00,0x06,0x80,0x40,
+ 0x75,0xa6,0x01,0x75,0xa7,0xff,0x75,0xa2,0x00,0x75,0xa3,0x00,0x75,0xa4,0x04,0x75,
+ 0xa5,0x00,0x75,0xa9,0x00,0x75,0xaa,0x04,0x75,0xab,0x00,0x78,0x2d,0xe6,0x60,0x1a,
+ 0x76,0x00,0x75,0xbe,0x00,0x75,0xbf,0x00,0x75,0xc2,0x10,0x75,0xc3,0x11,0x75,0xc4,
+ 0x01,0x75,0xc5,0x00,0x75,0xc6,0x00,0x75,0xc7,0x00,0x75,0xa1,0x03,0x75,0xa1,0x02,
+ 0xd0,0x93,0xd0,0x94,0xd0,0x07,0xd0,0x06,0xd0,0x05,0xd0,0x04,0xd0,0x03,0xd0,0x02,
+ 0xd0,0x01,0xd0,0x00,0xd0,0xd0,0xd0,0x86,0xd0,0x84,0xd0,0x85,0xd0,0x82,0xd0,0x83,
+ 0xd0,0xf0,0xd0,0xe0,0x32,0xc0,0xe0,0xc0,0xf0,0xc0,0x83,0xc0,0x82,0xc0,0x85,0xc0,
+ 0x84,0xc0,0x86,0x75,0x86,0x00,0xc0,0xd0,0x75,0xd0,0x00,0xc0,0x00,0xc0,0x01,0xc0,
+ 0x02,0xc0,0x03,0xc0,0x04,0xc0,0x05,0xc0,0x06,0xc0,0x07,0xc0,0x94,0xc0,0x93,0x7b,
+ 0x00,0x12,0x0c,0x3f,0x78,0x31,0xe6,0xff,0x64,0x0d,0x60,0x04,0xef,0xb4,0x0f,0x04,
+ 0x78,0x30,0x80,0x2a,0xef,0xb4,0x0e,0x02,0x80,0x26,0xef,0xb4,0x0c,0x02,0x80,0x20,
+ 0xef,0xb4,0x0b,0x06,0x78,0x33,0x76,0x00,0x80,0x16,0xef,0xb4,0x0a,0x0a,0x78,0x32,
+ 0x76,0x01,0x78,0x2c,0x76,0x00,0x80,0x08,0xef,0xb4,0x09,0x09,0x78,0x2e,0x76,0x01,
+ 0x75,0xff,0x01,0x80,0x09,0x7d,0x0d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xd0,0x02,0xd0,0x01,0xd0,0x00,0xd0,0xd0,0xd0,0x86,0xd0,0x84,
+ 0xd0,0x85,0xd0,0x82,0xd0,0x83,0xd0,0xf0,0xd0,0xe0,0x32,0xf6,0x7d,0x01,0xfc,0x7f,
+ 0xbd,0x12,0x0c,0x5e,0x7f,0x50,0x12,0x0c,0x5e,0x7d,0x98,0x7f,0x45,0x12,0x0c,0x5e,
+ 0x7d,0x39,0x0f,0x12,0x0c,0x5e,0x7f,0x20,0x7e,0x03,0xe4,0xfd,0xfc,0xc3,0xed,0x9f,
+ 0xec,0x9e,0x50,0x0a,0x00,0x00,0x00,0x0d,0xbd,0x00,0x01,0x0c,0x80,0xef,0x22,0x7a,
+ 0x00,0x79,0x31,0x7f,0x0a,0x8f,0x93,0x75,0x96,0x01,0xe4,0xff,0x00,0x0f,0xbf,0x02,
+ 0xfb,0xe5,0x95,0x02,0x0b,0x20,0x7d,0xff,0x7c,0x00,0x12,0x0c,0x5e,0x0f,0x8d,0x94,
+ 0x8f,0x93,0x75,0x96,0x02,0x22,0xee,0x30,0xe7,0x07,0xc3,0xe4,0x9f,0xff,0xe4,0x9e,
+ 0xfe,0x22
+};
+
+uint32_t LoadFirmware(void)
+{
+ memcpy(Firmware, Firmware_Ranging, sizeof(Firmware_Ranging));
+ return sizeof(Firmware_Ranging);
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Firmware.h Thu May 28 02:30:39 2020 +0000 @@ -0,0 +1,12 @@ +#ifndef _FIRMWAREE_ +#define _FIRMWAREE_ + +#include "mbed.h" +#include "max32630fthr.h" + + +uint32_t LoadFirmware(void); + +#endif + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/RegTable.cpp Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,267 @@
+#include "DUT_RegConfig.h"
+
+extern DUTREG dut_reg[DUT_REG_NUM];
+
+const unsigned char reg_table[] = {
+ 0x00, 0x03,
+ 0x01, 0x00,
+ 0x02, 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E2, 0x00,
+ 0xE3, 0x07,
+ 0xE4, 0xD1,
+ 0xE5, 0x01,
+ 0xE6, 0x00,
+ 0xE7, 0x00,
+ 0xE8, 0x08,
+ 0xE9, 0x00,
+ 0xEA, 0xFF,
+ 0xEB, 0x00,
+ 0xEC, 0x18,
+ 0xED, 0x01,
+ 0xEE, 0x00,
+ 0xEF, 0x00,
+ 0xF0, 0x00,
+ 0xF1, 0x00,
+ 0xF2, 0x00,
+ 0xF3, 0x00,
+ 0xF4, 0x00,
+ 0xF5, 0x00,
+ 0xF6, 0x00,
+ 0xF7, 0xFF,
+ 0xF8, 0x97,
+ 0xF9, 0x00,
+ 0xFA, 0x00,
+ 0xFB, 0x00,
+ 0xFC, 0x04,
+ 0xFD, 0x94,
+ 0xFE, 0x00,
+ 0xFF, 0x0F
+};
+
+void LoadRegTable(void)
+{
+ memcpy(dut_reg, reg_table, sizeof(reg_table));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RegTable.h Thu May 28 02:30:39 2020 +0000 @@ -0,0 +1,10 @@ +#ifndef __REGTABLE__ +#define __REGTABLE__ + +#include "mbed.h" +#include "max32630fthr.h" + + +void LoadRegTable(void); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Thu May 28 02:30:39 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/SomeRandomBloke/code/SDFileSystem/#9c5f0c655284
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ServoRun.cpp Thu May 28 02:30:39 2020 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+#include "max32630fthr.h"
+#include "USBSerial.h"
+#include "I2CSlave.h"
+#include "CmdHandler.h"
+#include "DUT_RegConfig.h"
+#include "AVDD_CONFIG.h"
+#include "ServoRun.h"
+
+extern DigitalOut PULSE;
+extern DigitalOut DI;
+
+uint32_t servo_run = 0;
+
+void ServoRunThread(void)
+{
+ uint32_t step = 0;
+
+ while(1)
+ {
+ if(servo_run)
+ {
+ step = servo_run * 40;
+ while(step--)
+ {
+ PULSE = 1;
+ wait_ms(1);
+ PULSE = 0;
+ wait_ms(1);
+ }
+ servo_run = 0;
+ }
+ wait_ms(100);
+ }
+}
+
+void ServoRun(uint8_t dir, uint32_t mm)
+{
+ DI = dir;
+ servo_run = mm;
+}
+
+uint32_t CheckUntil(void)
+{
+ return servo_run;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ServoRun.h Thu May 28 02:30:39 2020 +0000 @@ -0,0 +1,11 @@ +#ifndef __SERVO_RUN__ +#define __SERVO_RUN__ + +void ServoRunThread(void); + +void ServoRun(uint8_t dir, uint32_t mm); + +uint32_t CheckUntil(void); + +#endif +
--- a/USBDevice.lib Wed May 06 05:56:23 2020 +0000 +++ b/USBDevice.lib Thu May 28 02:30:39 2020 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/#dad310740b28 +https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/#63a8e6af8712
--- a/main.cpp Wed May 06 05:56:23 2020 +0000
+++ b/main.cpp Thu May 28 02:30:39 2020 +0000
@@ -34,13 +34,24 @@
#include "max32630fthr.h"
#include "USBSerial.h"
#include "I2CSlave.h"
+#include "CmdHandler.h"
+#include "DUT_RegConfig.h"
+#include "AVDD_CONFIG.h"
+#include "ServoRun.h"
+#include "SDFileSystem.h"
+#include "AnalogIn.h"
+
+#define EVIC
+
+void usb_rx_callback(void);
+void usb_receive(void);
MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
// Hardware serial port over DAPLink
-Serial uart(P2_1, P2_0);
+Serial uart(P3_1, P3_0);
-I2C slave(P3_4, P3_5);
+I2C i2c_v(P3_4, P3_5);
// Virtual serial port over USB
USBSerial microUSB;
@@ -48,26 +59,119 @@
DigitalOut gLED(LED2);
DigitalOut bLED(LED3);
+//======for EVIC
+#ifdef EVIC
+AnalogIn ain(AIN_1);
+DigitalOut xSHUT(P5_3);
+InterruptIn chip_int(P3_2);
+//AnalogIn()
+DigitalOut AVDDEN(P3_3);
+DigitalOut HIGH_EN(P5_6);
+DigitalOut A0(P4_0);
+
+DigitalOut PULSE(P5_1);
+DigitalOut DI(P5_2);
+
+SDFileSystem sd(P0_5, P0_6, P0_4, P0_7, "sd"); // mosi, miso, sclk, cs
+#endif
+//======
+
+//======for Ofilm
+#ifdef OFILM
+DigitalOut xSHUT(P5_4);
+DigitalOut EN_Power(P5_3);
+DigitalOut EN_OSC(P5_5);
+InterruptIn chip_int(P3_3);
+#endif
+//======
+
+
+
+//Queue<uint8_t, 2048> cmd_queue;
+
+Thread cmd_handle_thread;
+Thread coutinu_measure_thread;
+Thread Histogram_thread;
+Thread Sevo_Thread;
+//Thread usb_receive_thread;
+
+Semaphore usb_semph(32);
+
// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
int main()
{
- microUSB.printf("micro USB serial port\r\n");
+ //microUSB.printf("micro USB serial port\r\n");
+
+ float v = 2.7;
+ uint8_t test = 0;
+ float V_I[10];
- rLED = LED_ON;
- gLED = LED_ON;
- bLED = LED_OFF;
+ #ifdef EVIC
+ xSHUT = 1;
+ AVDDEN = 1;
+ HIGH_EN = 0;
+ A0 = 0;
+ DI = 0;
+ PULSE = 0;
+ #endif
+
+ #ifdef OFILM
+ xSHUT = 1;
+ EN_Power = 0;
+ EN_OSC = 0;
+ #endif
+
+ //uart.baud(115200);
+ microUSB.attach(usb_rx_callback);
+ chip_int.rise(InterruptHandle);
rLED = LED_OFF;
+ gLED = LED_OFF;
+ bLED = LED_OFF;
+
+ i2c_v.frequency(100000);
- slave.frequency(400000);
-
+ SetVoltageAVDD(3.3);
- while(1)
- {
- microUSB.printf("micro USB serial port\r\n");
+ //wait(1);
+ DUT_RegInit();
+ wait(1);
+ //DUT_FirmwareInit();
+
+ cmd_handle_thread.start(CmdHandleTask);
+ coutinu_measure_thread.start(ContinuousMeasureReport);
+ Histogram_thread.start(HistogramReport);
+ //usb_receive_thread.start(usb_receive);
+ Sevo_Thread.start(ServoRunThread);
+
+ while(1) {
+ //microUSB.printf("micro USB serial port\r\n");
+ //microUSB.writeBlock((uint8_t*)"Hello", 5);
bLED = !bLED;
+
+ V_I[0] = ain.read()*5000.0f;
+ HandleFreqReport(V_I);
+ //SetVoltageAVDD(v);
+ //v = v + 0.1;
+ //if(v > 3.7)
+ // v = 2.7;
wait(2);
+
+ //if(test < 10)
+ // ServoRun(1,10);//Back 10mm
+ //else if(test > 10)
+ // ServoRun(0,10);//Forward 10mm
+ //test++;
+ //if(test == 20)
+ // test = 0;
}
}
+void usb_rx_callback(void)
+{
+ //usb_semph.release();
+}
+
+
+