4030 views|16 replies

205

Posts

0

Resources
The OP
 

[National Technology Low Power Series N32L43x Review] 08. Software and Hardware I2C Driver 1.5-inch 16-color grayscale OLED display [Copy link]

 
 

Overview

The National N32L43x series MCU has a 2-way hardware I2C interface, which provides multi-host functionality and controls all I2C bus-specific timing, protocols, arbitration, and timing. It supports multiple communication modes (up to 1MHz), supports DMA operations, and is compatible with SMBus2.0. The main functions are described as follows:

Multi-host function: The module can be used as both a master device and a slave device;

  • I2C master function;
  • Generate clock;
  • Generate start and stop signals;
  • I2C Slave Functionality
  • Programmable address detection;
  • The I2C interface supports 7-bit or 10-bit addressing and dual slave address response capability in 7-bit slave mode;
  • Stop position detection;
  • Generate and detect 7-bit/10-bit address and general call;
  • Support different communication speeds;
  1. Standard speed (up to 100 kHz);
  2. Fast (up to 400 kHz);
  3. Fast+ (up to 1MHz);
  • Status Flags:
  1. Transmitter/receiver mode flag;
  2. Byte sending end mark;
  3. I2C bus busy flag;
  • Error Flags:
  1. Arbitration lost in master mode;
  2. Error in acknowledgment (ACK) after address/data transmission;
  3. An erroneous start or stop condition was detected;
  4. Overflow or underflow when stretching the clock function is prohibited;
  • 2 interrupt vectors:
  1. 1 interrupt for successful address/data communication;
  2. 1 interrupt for errors;
  • Optional stretched clock function
  • DMA to single-byte buffer;
  • Configurable PEC (Packet Error Check) generation or checking
  • In send mode, the PEC value can be transmitted as the last byte
  • PEC error checking for the last received byte
  • SMBus 2.0 compliant
  1. 25 ms clock low timeout delay
  2. 10 ms master cumulative clock low extension time
  3. 25 ms slave device cumulative clock low extension time
  4. Hardware PEC generation/verification with ACK control
  5. Support Address Resolution Protocol (ARP)
  • SMBus compatible

16 Gray OLED

Generally, OLEDs are monochrome. For a 0.96-inch 128*64 pixel OLED, one pixel only needs 1 bit to represent, and its video memory is 1024 bytes. It can easily achieve a smooth effect through the 400kbps communication rate of I2C; but for a 16-gray OLED, one pixel needs 4 bits to represent. The 1.5-inch 16-gray OLED used in this article has a pixel of 128*128, so the video memory needs 8KB of space. If the display is refreshed at a rate of 400kbps, it will be obviously stuck/unsmooth. It happens that the hardware I2C of the National N32L43x series MCU supports the fast+ mode, and the communication rate can reach 1MHz, which fully meets the display refresh requirements of this OLED.

Code Implementation

/* Define to prevent recursive inclusion -------------------------------------*/
#define __OLED_C__


/* Includes ------------------------------------------------------------------*/
#include "OLED.h"


#if ENABLE_OLED


/* Private typedef -----------------------------------------------------------*/


/* Private define ------------------------------------------------------------*/
#define sI2C_SCL_PORT  GPIOB
#define sI2C_SCL_PIN   GPIO_PIN_8

#define sI2C_SDA_PORT  GPIOB
#define sI2C_SDA_PIN   GPIO_PIN_9


/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/


/* Exported variables --------------------------------------------------------*/
/* Exported function prototypes ----------------------------------------------*/


/*******************************************************************************
 * [url=home.php?mod=space&uid=159083]@brief[/url] * @param       
 * @retval      
 * [url=home.php?mod=space&uid=1020061]@attention[/url] *******************************************************************************/
void sI2C_Delay(uint32_t t)
{
    while(t--);
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void sI2C_Init(void)
{
    GPIO_InitType GPIO_InitStructure;

    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin            = GPIO_PIN_8 | GPIO_PIN_9;
    GPIO_InitStructure.GPIO_Current   = GPIO_DC_12mA;
    GPIO_InitStructure.GPIO_Slew_Rate = GPIO_Slew_Rate_High;
    GPIO_InitStructure.GPIO_Mode      = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Pull      = GPIO_Pull_Up;	  
    GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void sI2C_SDA_IN(void)
{
    GPIO_InitType GPIO_InitStructure;

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin            = GPIO_PIN_9;
    GPIO_InitStructure.GPIO_Current   = GPIO_DC_12mA;
    GPIO_InitStructure.GPIO_Slew_Rate = GPIO_Slew_Rate_High;
    GPIO_InitStructure.GPIO_Mode      = GPIO_Mode_Input;
    GPIO_InitStructure.GPIO_Pull      = GPIO_Pull_Up;	  
    GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void sI2C_SDA_OUT(void)
{
    GPIO_InitType GPIO_InitStructure;

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin            = GPIO_PIN_9;
    GPIO_InitStructure.GPIO_Current   = GPIO_DC_12mA;
    GPIO_InitStructure.GPIO_Slew_Rate = GPIO_Slew_Rate_High;
    GPIO_InitStructure.GPIO_Mode      = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Pull      = GPIO_Pull_Up;	  
    GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void sI2C_START(void)
{
    sI2C_SDA_OUT();
    GPIO_WriteBit(sI2C_SDA_PORT, sI2C_SDA_PIN, Bit_SET);    sI2C_Delay(10);
    GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_SET);    sI2C_Delay(10);
    GPIO_WriteBit(sI2C_SDA_PORT, sI2C_SDA_PIN, Bit_RESET);  sI2C_Delay(10);
    GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_RESET);  sI2C_Delay(10);
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void sI2C_STOP(void)
{
    sI2C_SDA_OUT();
    GPIO_WriteBit(sI2C_SDA_PORT, sI2C_SDA_PIN, Bit_RESET);  sI2C_Delay(10);
    GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_SET);    sI2C_Delay(10);
    GPIO_WriteBit(sI2C_SDA_PORT, sI2C_SDA_PIN, Bit_SET);    sI2C_Delay(10);
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
uint8_t sI2C_WaitACK(void)
{
    uint32_t Timeout = 0;

    GPIO_WriteBit(sI2C_SDA_PORT, sI2C_SDA_PIN, Bit_SET);    /* 释放总线 */

    sI2C_SDA_IN();
    sI2C_Delay(5);

    GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_SET);    sI2C_Delay(5);

    while(GPIO_ReadInputDataBit(sI2C_SDA_PORT,sI2C_SDA_PIN))
    {
        if(Timeout++ > 250)
        {
            sI2C_STOP(); return 1;
        }
    }

    GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_RESET);  sI2C_Delay(5);

    return 0;
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void sI2C_SendData(uint8_t Data)
{
    sI2C_SDA_OUT();
    GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_RESET);

    for(uint8_t i = 0; i < 8; i++)
    {
        if(Data & (0x80 >> i))
        {
            GPIO_WriteBit(sI2C_SDA_PORT, sI2C_SDA_PIN, Bit_SET);
        }
        else
        {
            GPIO_WriteBit(sI2C_SDA_PORT,sI2C_SDA_PIN, Bit_RESET);
        }

        sI2C_Delay(5);

        GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_SET);    sI2C_Delay(5);
        GPIO_WriteBit(sI2C_SCL_PORT, sI2C_SCL_PIN, Bit_RESET);  sI2C_Delay(5);
    }
}


#define USE_H_I2C   0


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_InitI2C(void)
{
#if USE_H_I2C
    GPIO_InitType GPIO_InitStructure;
    I2C_InitType  I2C1_InitStructure;

    RCC_EnableAPB1PeriphClk(RCC_APB1_PERIPH_I2C1,  ENABLE);

    I2C_DeInit(I2C1);

    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB | RCC_APB2_PERIPH_AFIO,  ENABLE);

    /*PB8 -- SCL; PB9 -- SDA*/
    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin            = GPIO_PIN_8 | GPIO_PIN_9;
    GPIO_InitStructure.GPIO_Slew_Rate = GPIO_Slew_Rate_High;
    GPIO_InitStructure.GPIO_Pull      = GPIO_Pull_Up;
    GPIO_InitStructure.GPIO_Mode      = GPIO_Mode_AF_OD;
    GPIO_InitStructure.GPIO_Alternate = GPIO_AF4_I2C1;
    GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);

    I2C_InitStruct(&I2C1_InitStructure);
    I2C1_InitStructure.ClkSpeed    = 100000;
    I2C1_InitStructure.BusMode     = I2C_BUSMODE_I2C;
    I2C1_InitStructure.FmDutyCycle = I2C_FMDUTYCYCLE_2;
    I2C1_InitStructure.OwnAddr1    = 0xFF;
    I2C1_InitStructure.AckEnable   = I2C_ACKEN;
    I2C1_InitStructure.AddrMode    = I2C_ADDR_MODE_7BIT;
    I2C_Init(I2C1, &I2C1_InitStructure);

    I2C_Enable(I2C1, ENABLE);
#else
    sI2C_Init();
#endif
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_WriteCMD(uint8_t Data)
{
#if USE_H_I2C
    while(I2C_GetFlag(I2C1, I2C_FLAG_BUSY));

    I2C_GenerateStart(I2C1, ENABLE);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG));

    I2C_SendAddr7bit(I2C1, 0x78, I2C_DIRECTION_SEND);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_TXMODE_FLAG));

    I2C_SendData(I2C1, 0x00);
    while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));

    I2C_SendData(I2C1, Data);
    while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));

    I2C_GenerateStop(I2C1, ENABLE);
#else
	sI2C_START();

	sI2C_SendData(0x78);
	sI2C_WaitACK();

	sI2C_SendData(0x00);
	sI2C_WaitACK();

	sI2C_SendData(Data);
	sI2C_WaitACK();

	sI2C_STOP();
#endif
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_WriteDAT(uint8_t Data)
{
#if USE_H_I2C
    while(I2C_GetFlag(I2C1, I2C_FLAG_BUSY));

    I2C_GenerateStart(I2C1, ENABLE);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG));

    I2C_SendAddr7bit(I2C1, 0x78, I2C_DIRECTION_SEND);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_TXMODE_FLAG));

    I2C_SendData(I2C1, 0x40);
    while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));

    I2C_SendData(I2C1, Data);
    while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));

    I2C_GenerateStop(I2C1, ENABLE);
#else
	sI2C_START();

	sI2C_SendData(0x78);
	sI2C_WaitACK();

	sI2C_SendData(0x40);
	sI2C_WaitACK();

	sI2C_SendData(Data);
	sI2C_WaitACK();

	sI2C_STOP();
#endif
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_WriteBuffer(const uint8_t *Buffer, uint32_t Length)
{
#if USE_H_I2C
    while(I2C_GetFlag(I2C1, I2C_FLAG_BUSY));

    I2C_GenerateStart(I2C1, ENABLE);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG));         // EV5

    I2C_SendAddr7bit(I2C1, 0x78, I2C_DIRECTION_SEND);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_TXMODE_FLAG));       // EV6

    I2C_SendData(I2C1, 0x40);
    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDING));      // EV8

    while(Length--)
    {
        I2C_SendData(I2C1, *Buffer++);
        while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDING));  // EV8
    }

    while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));       // EV8-2

    I2C_GenerateStop(I2C1, ENABLE);
#else
    sI2C_START();

    sI2C_SendData(0x78);
    sI2C_WaitACK();

    sI2C_SendData(0x40);
    sI2C_WaitACK();

    while(Length--)
    {
        sI2C_SendData(*Buffer++);
        sI2C_WaitACK();
    }

    sI2C_STOP();
#endif
}


/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_InitCFG(void)
{
    OLED_WriteCMD(0xAE);//关闭显示
	
	OLED_WriteCMD(0x15);//设置列地址
	OLED_WriteCMD(0x00);//起始地址00
	OLED_WriteCMD(0x3F);//结束列地址3F对应127列,每8列一组
	
	OLED_WriteCMD(0x75);//设置行地址
	OLED_WriteCMD(0x00);	//起始0
	OLED_WriteCMD(0x7F);	//结束127
	
	OLED_WriteCMD(0x81);//对比度设置
    OLED_WriteCMD(0x80);//1~255;默认0x7F (亮度设置,越大越亮)
	
	OLED_WriteCMD(0xA0);//显存映射
	OLED_WriteCMD(0x51);
	
	OLED_WriteCMD(0xA1);//显示起始行地址
	OLED_WriteCMD(0x00);
	
	OLED_WriteCMD(0xA2);//显示偏移
	OLED_WriteCMD(0x00);
	
	OLED_WriteCMD(0xA4);//正常显示模式
	
	OLED_WriteCMD(0xA8);//设置MUX 比率 16-128
	OLED_WriteCMD(0x7F);
	
	OLED_WriteCMD(0xB1);// Set phase length
	OLED_WriteCMD(0xF1);
	
	OLED_WriteCMD(0xB3); // Set Display Clock Divide Ratio/Oscillator Frequency
	OLED_WriteCMD(0x00); // 80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30 // 120Hz:0x50 130Hz:0x70
	
	OLED_WriteCMD(0xAB);
	OLED_WriteCMD(0x01);// set vdd internal
	
	OLED_WriteCMD(0xB6); // Set second pre-charge period
	OLED_WriteCMD(0x0F);
	
	OLED_WriteCMD(0xBE);// set VCOMH
	OLED_WriteCMD(0x0F);
	
	OLED_WriteCMD(0xBC);// set pre_charge voltage/VCOMH
	OLED_WriteCMD(0x08);
	
	OLED_WriteCMD(0xD5);// second precharge and VSL
	OLED_WriteCMD(0x62);
	
	OLED_WriteCMD(0xFD);// Unlock/Lock OLED driver IC MCU interface from entering command
	OLED_WriteCMD(0x12);
	
	OLED_WriteCMD(0xAF);//开启显示
}

/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_SetWindow(uint8_t StartX, uint8_t StartY, uint8_t EndX, uint8_t EndY)
{
    OLED_WriteCMD(0x15);
    OLED_WriteCMD(StartX/2);
    OLED_WriteCMD(EndX/2-1);

    OLED_WriteCMD(0x75);
    OLED_WriteCMD(StartY);
    OLED_WriteCMD(EndY-1);
}

/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_Clear(uint8_t Data)
{
    OLED_SetWindow(0, 0, 128, 128);

    for(uint32_t i = 0; i < OLED_HEIGHT*OLED_WIDTH/2; i++)
    {
        OLED_WriteDAT(Data);
    }
}

/*******************************************************************************
 * @brief       
 * @param       
 * @retval      
 * @attention   
*******************************************************************************/
void OLED_Init(void)
{
    OLED_InitI2C();

    OLED_InitCFG();

    OLED_Clear(0xFF);

    OLED_SetWindow(0, 0, 128, 128);
    OLED_WriteBuffer(gImage_AAA, sizeof(gImage_AAA));
}

Display Effect

Question Feedback

The above code uses two I2C driving modes, software and hardware, to drive the OLED display. For the software driving mode, the execution consumes a lot more resources than the hardware I2C, but it can successfully drive the OLED display, which shows that there is no problem with the upper-level functional code for the parameter configuration and refresh display of the OLED. However, it was not successful when driving the display through the hardware I2C mode. During this period, I tried to modify the I2C communication rate through software and weld pull-up resistors of different resistance values on the hardware. The hardware I2C has never communicated successfully. Through online single-step DEBUG debugging, it was found that after sending some data, it would be stuck in the waiting state of generating the START signal, as shown in the figure below; if conditions permit, I hope the original manufacturer can debug it together to see what exactly caused this phenomenon.

This post is from Domestic Chip Exchange

Latest reply

How did you solve it in the end?   Details Published on 2024-7-16 09:06
Personal signatureWe are a team and we work as a team !
 
 

205

Posts

0

Resources
2
 

I have referred to the I2C configuration and driver parts of driving 0.96-inch OLED by many netizens. For the 0.96-inch OLED with I2C interface, there is no problem in operation, but the hardware I2C cannot be connected on this 1.5-inch 16-gray OLED...

This post is from Domestic Chip Exchange

Comments

nmg
Use a logic analyzer to capture the waveform of the hardware IIC, and you may be able to find the problem.  Details Published on 2022-8-1 18:12
Use a logic analyzer to capture the waveform of the hardware IIC, and you may be able to find the problem.  Details Published on 2022-7-29 16:25
Personal signatureWe are a team and we work as a team !
 
 
 

6773

Posts

2

Resources
3
 
xld0932 posted on 2022-7-29 15:10 I referred to the I2C configuration and driver parts of driving 0.96-inch OLED by multiple netizens. For 0.96-inch OLED with I2C interface, there is no problem in operation, but here...

Use a logic analyzer to capture the waveform of the hardware IIC, and you may be able to find the problem.

This post is from Domestic Chip Exchange

Comments

The testing tools are not at hand at the moment...  Details Published on 2022-8-2 08:50
 
 
 

5220

Posts

239

Resources
4
 
xld0932 posted on 2022-7-29 15:10 I referred to the I2C configuration and driver parts of driving 0.96-inch OLED by multiple netizens. For 0.96-inch OLED with I2C interface, there is no problem in operation, but here...

The problem is not prominent, I almost missed it

In the future, you can consider displaying the problem directly in the title.

This post is from Domestic Chip Exchange
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

20

Posts

0

Resources
5
 

Put OLED_WriteCMD

I2C_SendData(I2C1, 0x00);

while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));

and OLED_WriteDAT

I2C_SendData(I2C1, 0x40);

while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_DATA_SENDED));

Try changing the I2C_EVT_MASTER_DATA_SENDED in these two sentences to I2C_EVT_MASTER_DATA_SENDING

This post is from Domestic Chip Exchange

Comments

Tried this before posting...  Details Published on 2022-8-2 08:48
 
 
 

3

Posts

0

Resources
6
 

It is recommended to refer to the opinions on the 5th floor. In addition, use an oscilloscope to look at the specific waveform to know which step is stuck. National Technical Data Link Download: ftp://58.250.18.138 (copy the link and open it with a file explorer)

This post is from Domestic Chip Exchange

Comments

Just refer to the official information and routines...  Details Published on 2022-8-2 08:49
 
 
 

205

Posts

0

Resources
7
 
805721366 Published on 2022-8-1 20:14 In OLED_WriteCMD, I2C_SendData(I2C1, 0x00); while (!I2C_CheckEvent(I2C1, I2C_EVT_MAS ...

Tried this before posting...

This post is from Domestic Chip Exchange
Personal signatureWe are a team and we work as a team !
 
 
 

205

Posts

0

Resources
8
 
Cangsang Xiaocao posted on 2022-8-1 22:48 It is recommended to refer to the opinions on the 5th floor. In addition, use an oscilloscope to look at the specific waveform to know which step is stuck. National Technical Data Link Download: ftp://58. ...

Just refer to the official information and routines...

This post is from Domestic Chip Exchange
Personal signatureWe are a team and we work as a team !
 
 
 

205

Posts

0

Resources
9
 
wangerxian posted on 2022-7-29 16:25 Use a logic analyzer to capture the waveform of the hardware IIC, and you may be able to find the problem.

The testing tools are not at hand at the moment...

This post is from Domestic Chip Exchange
Personal signatureWe are a team and we work as a team !
 
 
 

9717

Posts

24

Resources
10
 

Check the waveform on the bus to see if it is consistent with the expected one. In this case, the code seems to be fine. After executing I2C_GenerateStart(I2C1, ENABLE);, MSMODE should be set to 1 by the system. The stuck in while (!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG)) may be caused by ARLOST. The specific situation depends on the waveform.

This post is from Domestic Chip Exchange

Comments

It is true that when debugging in single step, it is stuck here. How to solve it? I have also seen netizens post programs to drive OLED through software and hardware I2C and SPI. I have also tested it. I can drive 0.96-inch OLED through hardware I2C, but it will get stuck when driving this 1.5-inch OLED.  Details Published on 2022-8-8 15:43
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

205

Posts

0

Resources
11
 
littleshrimp posted on 2022-8-8 15:31 Check the waveform on the bus to see if it is consistent with the expected one. In this case, the code seems to be fine. When executing I2C_GenerateStart(I2 ...

It is true that when debugging in single step, it is stuck here. How to solve it? I have also seen netizens post programs for driving OLED through software and hardware I2C and SPI. I have also tested it. I can drive 0.96-inch OLED through hardware I2C without any problem, but it is stuck when driving this 1.5-inch OLED. I have also tried to modify the I2C parameter configuration, but it did not solve the problem. I don’t have a logic analyzer at hand, so I can’t capture the waveform to see…

This post is from Domestic Chip Exchange

Comments

Try it. If the display screen is not connected, can the while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG)); loop run through?  Details Published on 2022-8-8 15:52
Personal signatureWe are a team and we work as a team !
 
 
 

9717

Posts

24

Resources
12
 
xld0932 posted on 2022-8-8 15:43 Indeed, when debugging in single step, it is stuck here; how to solve it? I also saw netizens posting how OLED is driven by software and hardware I2C and SPI...

Try it. If the display screen is not connected, can the while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG)); loop run through?

This post is from Domestic Chip Exchange

Comments

This is not because it failed to run from the beginning. It got stuck in the middle of configuring the OLED parameters...  Details Published on 2022-8-8 16:03
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

205

Posts

0

Resources
13
 
littleshrimp posted on 2022-8-8 15:52 Try it. If the display screen is not connected, the while(!I2C_CheckEvent(I2C1, I2C_EVT_MASTER_MODE_FLAG)); loop can run through...

This is not because it failed to run from the beginning. It got stuck in the middle of configuring the OLED parameters...

This post is from Domestic Chip Exchange

Comments

It seems that we can only start with the waveform.  Details Published on 2022-8-8 16:08
Personal signatureWe are a team and we work as a team !
 
 
 

9717

Posts

24

Resources
14
 
xld0932 posted on 2022-8-8 16:03 This is not that it can't run at the beginning. When configuring the OLED parameters, the process got stuck in the middle...

It seems that we can only start with the waveform.

This post is from Domestic Chip Exchange
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

12

Posts

1

Resources
15
 
How is the environment at National Technology? I heard the salary is very good. Can anyone share the real situation?
This post is from Domestic Chip Exchange

Comments

I want to gossip too.  Details Published on 2023-2-14 10:30
 
 
 

205

Posts

0

Resources
16
 
Future IC posted on 2023-2-13 09:21 What is the environment of National Technology? I heard that the treatment is very good. Does anyone share the real situation?

I want to gossip too.

This post is from Domestic Chip Exchange
Personal signatureWe are a team and we work as a team !
 
 
 

3

Posts

0

Resources
17
 

How did you solve it in the end?

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Featured Posts
Briefly describe chip packaging technology

(I) Since Intel Corporation of the United States designed and manufactured a 4-bit microprocessor chip in 1971, in more ...

Infineon Position2Go Development Kit Review - skypinglee

This content is provided by EEWORLD Forum 1. Unboxing I am honored to participate in the evaluation of the Infineon Po ...

Unboxing and verifying BOX function through APP

Charge and perform various tests. Gain in-depth understanding of the performance of various sensors. The detection of a ...

A USB20 communication design for real-time image system.pdf

A USB20 communication design for real-time image system.pdf

【GD32E503 Review】One-month test summary

GD32 got to know each other because of testing. GD32E503V-EVAL development board, core chip GD32E503VET6 (hereinafter re ...

[Fudan Micro FM33LC046N] The second PACK solves the JLINK problem but there is another problem?

Finally I made up my mind to download MDK530, and finally solved the problem that the PACK package could not be installe ...

RT-thread studio installation tutorial

rt-thread studio installation First, you need to make sure that rt-thread studio has been installed Find the SDK Manag ...

[Runhe Neptune Review] Five PWM

PWM: Pulse Width Modulation It is to periodically control the time (duty cycle) of IO pulling high and low to control th ...

Embedded Qt-Simple Network Surveillance Camera

This article uses Qt to implement a network camera function, which includes a server and a client. The server is used ...

[The strongest open source] Hand-rubbed 120W switching power supply

I recently took the time to make a switching power supply 645265 645262 645263 645264 645261 645260

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list