From: kyz Date: Tue, 7 May 2024 07:04:33 +0000 (+0800) Subject: v0.4 新板子的max31865 spi引脚交换 X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=ebe68f34223656d69e4c0260689b8474c5adcab5;p=zd%2Fzd-mcu.git v0.4 新板子的max31865 spi引脚交换 新板子max31865小板子集成到主板上,spi控制连接不正确, 通过软件修改交换SDI和SDO --- diff --git a/STM32/code/MAX31865/max31865.c b/STM32/code/MAX31865/max31865.c index 5ab21451..5c0e9ae6 100644 --- a/STM32/code/MAX31865/max31865.c +++ b/STM32/code/MAX31865/max31865.c @@ -60,14 +60,14 @@ void MAX31865_SPI_Init(void) GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOE, &GPIO_InitStructure); //SCKºÍMOSIÒý½Å³õʼ»¯ - GPIO_InitStructure.Pin = GPIO_PIN_11|GPIO_PIN_12; + GPIO_InitStructure.Pin = GPIO_PIN_11|GPIO_PIN_13; GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP ; //ÍÆÍìÊä³ö GPIO_InitStructure.Pull = GPIO_PULLUP; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOB, &GPIO_InitStructure); //MISOÒý½Å³õʼ»¯ - GPIO_InitStructure.Pin = GPIO_PIN_13; + GPIO_InitStructure.Pin = GPIO_PIN_12; GPIO_InitStructure.Mode = GPIO_MODE_INPUT ; //¸¡¿ÕÊäÈë HAL_GPIO_Init(GPIOB, &GPIO_InitStructure); diff --git a/STM32/code/MAX31865/max31865.h b/STM32/code/MAX31865/max31865.h index 669e552c..bbaa5aa9 100644 --- a/STM32/code/MAX31865/max31865.h +++ b/STM32/code/MAX31865/max31865.h @@ -19,6 +19,8 @@ typedef struct #define SCK_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11,GPIO_PIN_SET) /* SCK = 1 */ #define SCK_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11,GPIO_PIN_RESET) /* SCK = 0 */ +#if 0 + #define MOSI_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_SET) /* MOSI = 1 */ #define MOSI_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_RESET) /* MOSI = 0 */ @@ -27,6 +29,18 @@ typedef struct #define MIOS_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13,GPIO_PIN_SET) /* MOSI = 1 */ #define MIOS_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13,GPIO_PIN_RESET) /* MOSI = 0 */ +#else + +#define MOSI_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13,GPIO_PIN_SET) /* MOSI = 1 */ +#define MOSI_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13,GPIO_PIN_RESET) /* MOSI = 0 */ + +#define SPI_READ_MISO HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_12) /* ¶ÁMISO¿ÚÏß״̬ */ + +#define MIOS_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_SET) /* MOSI = 1 */ +#define MIOS_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_RESET) /* MOSI = 0 */ + +#endif + #define FAULTSTAT_REG_R 0x07 //FAULT #define CONFIG_REG_W 0x80 //WRITE CONFIG #define CONFIG_REG_R 0x00 //READ CONFIG diff --git a/STM32/code/mcu_com/mcu_com.c b/STM32/code/mcu_com/mcu_com.c index 01f66bd1..9205d33a 100644 --- a/STM32/code/mcu_com/mcu_com.c +++ b/STM32/code/mcu_com/mcu_com.c @@ -1708,7 +1708,7 @@ void Mqtt_Proactive_Escalation(void) void send_mcuSoftWare_Version(void) { uint8_t len; - uint8_t data[2] = {0x01, 0x04};//版本1.4 + uint8_t data[2] = {0x02, 0x04};//版本1.4 len = McuCom_Sensor_Packet(GET_SOFT_VERSION, 0x02, data, 2);