v0.4 新板子的max31865 spi引脚交换
authorkyz <kongyuzhong@google.com>
Tue, 7 May 2024 07:04:33 +0000 (15:04 +0800)
committerkyz <kongyuzhong@google.com>
Tue, 7 May 2024 07:04:33 +0000 (15:04 +0800)
新板子max31865小板子集成到主板上,spi控制连接不正确,
通过软件修改交换SDI和SDO

STM32/code/MAX31865/max31865.c
STM32/code/MAX31865/max31865.h
STM32/code/mcu_com/mcu_com.c

index 5ab2145159bd45ebb5a18cb5dd49357c7d03fd3b..5c0e9ae61971c103098165659ff346c77add3295 100644 (file)
@@ -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);
                
index 669e552ca86d90a529c40d6bc41ee2a29747253a..bbaa5aa9a6f1c86f0bfddb2f7ba6f2c1a81b0257 100644 (file)
@@ -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
index 01f66bd19a0810ba21035483d56e175ff1f15122..9205d33a562dd1009445a0e8b8da6ae3b0c07924 100644 (file)
@@ -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);