comparison Small_CPU/Src/i2c.c @ 82:a6f0881074a4 kittz

+i2c analog noise filtering spi more stable
author Dmitry Romanov <kitt@bk.ru>
date Tue, 20 Nov 2018 12:08:19 +0300
parents 5f11787b4f42
children e6abbef57475
comparison
equal deleted inserted replaced
80:cc2bb7bb8456 82:a6f0881074a4
67 67
68 HAL_StatusTypeDef MX_I2C1_Init(void) 68 HAL_StatusTypeDef MX_I2C1_Init(void)
69 { 69 {
70 I2cHandle.Instance = I2Cx; 70 I2cHandle.Instance = I2Cx;
71 I2cHandle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; 71 I2cHandle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
72 I2cHandle.Init.ClockSpeed = 100000;//400000; 72 I2cHandle.Init.ClockSpeed = 400000;//400000;
73 I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED; 73 I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
74 I2cHandle.Init.DutyCycle = I2C_DUTYCYCLE_16_9; 74 I2cHandle.Init.DutyCycle = I2C_DUTYCYCLE_16_9;
75 I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED; 75 I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
76 I2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED; 76 I2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED;
77 I2cHandle.Init.OwnAddress1 = 0x01; 77 I2cHandle.Init.OwnAddress1 = 0x01;
78 78
79 global.dataSendToSlaveStopEval = 1; 79 global.dataSendToSlaveStopEval = 1;
80 80
81 global.I2C_SystemStatus = HAL_I2C_Init(&I2cHandle); 81 global.I2C_SystemStatus = HAL_I2C_Init(&I2cHandle);
82 HAL_I2CEx_AnalogFilter_Config(&I2cHandle, I2C_ANALOGFILTER_ENABLED);
83
82 84
83 global.dataSendToSlaveStopEval = 0; 85 global.dataSendToSlaveStopEval = 0;
84 if(global.dataSendToSlavePending) 86 if(global.dataSendToSlavePending)
85 { 87 {
86 scheduleSpecial_Evaluate_DataSendToSlave(); 88 scheduleSpecial_Evaluate_DataSendToSlave();