2019-10-25 01:34 PM
Hi. I'm not a English speaker. Sorry for my poor English.
My code including EITHER I2C or SPI works successfully on STM32F303K8T6 Nucleo Board. However, with my code including BOTH I2C and SPI , Only SPI functions work correctly ,but I2Cs don't.
Using a ocsiloscope, It was found that voltage levels of I2C pins don't fluctuate at all when SPI initialization code exists. Is it impossible to use I2C and SPI function at the same time?
#include "main.h"
#include "dac.h"
#include "dma.h"
#include "i2c.h"
#include "spi.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
int main(void){
MX_GPIO_Init();
MX_DMA_Init();
MX_I2C1_Init();
MX_USART2_UART_Init();
MX_DAC1_Init();
MX_DAC2_Init();
MX_TIM6_Init();
MX_SPI1_Init();
MX_I2C1_Init();
uint8_t aTxBuffer = 0x3F; //some command to send
HAL_I2C_Master_Transmit(&hi2c1, DEVICE_ADDRESS, (uint8_t*)aTxBuffer, 1, 1000);
}
The Initialization code was generated by CubeIED Device Configuration Tool.
Solved! Go to Solution.
2024-06-27 07:58 AM - edited 2024-06-27 07:59 AM
Four different people complaining about a similar issue, this looks like more than a random newbie misconfig. At the very least something needs to be communicated better in the docs or through the CubeMX GUI.
@STOne-32 , perhaps you have some insight to offer for this thread?