any one can change STM32F103 code for NCS1.9?

Hello,

i've nRF5340-DK,  3 wire SPI oled model.

any one can change STM32F103 code  for NCS1.9?

the oled can light on, but no show text, maybe SPI recv Font incorrect.

the H code i've do change,  not sure if it's correct.

// #define OLED_SCL_Clr() GPIO_ResetBits(GPIOA,GPIO_Pin_0)//SCL
// #define OLED_SCL_Set() GPIO_SetBits(GPIOA,GPIO_Pin_0)
// #define OLED_SCL_Clr() gpio_port_set_bits_raw(sclk.port, (gpio_port_pins_t)BIT(sclk.pin));
// #define OLED_SCL_Set() gpio_port_clear_bits_raw(sclk.port, (gpio_port_pins_t)BIT(sclk.pin))

// #define OLED_SDA_Clr() GPIO_ResetBits(GPIOA,GPIO_Pin_1)//SDA
// #define OLED_SDA_Set() GPIO_SetBits(GPIOA,GPIO_Pin_1)
// #define OLED_SDA_Clr() gpio_port_set_bits_raw(mosi.port, (gpio_port_pins_t)BIT(mosi.pin))
// #define OLED_SDA_Set() gpio_port_clear_bits_raw(mosi.port, (gpio_port_pins_t)BIT(mosi.pin))

// #define OLED_DC_Clr()  GPIO_ResetBits(GPIOA,GPIO_Pin_2)//DC
// #define OLED_DC_Set()  GPIO_SetBits(GPIOA,GPIO_Pin_2)
#define OLED_DC_Clr() gpio_pin_set_dt(&dcdc, 0)
#define OLED_DC_Set() gpio_pin_set_dt(&dcdc, 1)
 		     
// #define OLED_CS_Clr()  GPIO_ResetBits(GPIOA,GPIO_Pin_3)//CS1
// #define OLED_CS_Set()  GPIO_SetBits(GPIOA,GPIO_Pin_3)
#define OLED_CS_Clr() gpio_pin_set_dt(&cs1, 0)
#define OLED_CS_Set() gpio_pin_set_dt(&cs1, 1)
 		     
// #define OLED_READ_FS0()    GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_4)//FS0
// #define OLED_READ_FS0()    ((struct gpio_driver_data *)fs0.port->data)
#define OLED_READ_FS0()        spi_rx_one_byte()

// #define OLED_ROM_CS_Clr()  GPIO_ResetBits(GPIOA,GPIO_Pin_5)//CS2
// #define OLED_ROM_CS_Set()  GPIO_SetBits(GPIOA,GPIO_Pin_5)
#define OLED_ROM_CS_Clr() gpio_pin_set_dt(&cs2, 0)
#define OLED_ROM_CS_Set() gpio_pin_set_dt(&cs2, 1)

      

thanks

Best regards

  • Hi,

    I'm not sure I understand what your question is, or what code you are referencing.

    As far as I can see, STM32F103 is a microcontroller and not a OLED display. 

    Is the code you have posted part of nRF Connect SDK or did you write it yourself?

    What did you want us to change?

    Best regards,
    Jørgen

  • Hi,

    thanks,

    At first I had no clue, i don't know where to start.

    but now,  i've slove it,  use spi,

    &spi3 {
        compatible = "nordic,nrf-spim";
        label = "SPI_3";
        status = "okay";
        sck-pin = < 0x2a >;
        miso-pin = < 0x2e >;
        mosi-pin = < 0x2b >;
    };
    static struct gpio_dt_spec dcdc = GPIO_DT_SPEC_GET_OR(DT_NODELABEL(dcdc), gpios,{0});
    static struct gpio_dt_spec cs1 = GPIO_DT_SPEC_GET_OR(DT_NODELABEL(cs1), gpios,{0});
    static struct gpio_dt_spec cs2 = GPIO_DT_SPEC_GET_OR(DT_NODELABEL(cs2), gpios,{0});
         
    Best regards
Related