spi2 bus clock and mosi pin do not output signal.

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
kuda
Offline
Last seen:1 month 3 weeks ago
Joined:2020-03-21 14:58
spi2 bus clock and mosi pin do not output signal.

Hi,

我正在尝试在DA14683开发套件中与ST7735进行液晶显示器和生物传感器。

Both ST7735 and bio sensor are SPI bus protocol. I want to set ST7735 on spi 2 and bio sensor on spi 1.

I had test ST7735 on spi1 and it is work.

However, I modify st7735 from spi 1 to spi2, csn pin is work but the clock and mosi pin do not output signal.

Measurment result as attached file.

是否需要设置任何参数或API?

//************* modify st7735 from spi 1 to spi2

SPI_BUS(SPI1)

#ifdef CONFIG_SPI_DISPLAY
// SPI_SLAVE_DEVICE(SPI1, DISPLAY_SPI, HW_GPIO_PORT_DISPLAY_SPI_CSN, HW_GPIO_PIN_DISPLAY_SPI_CSN, HW_SPI_WORD_8BIT, HW_SPI_POL_LOW, HW_SPI_PHA_MODE_0, HW_SPI_FREQ_DIV_2, HW_DMA_CHANNEL_0);
#endif
spi_bus_end.

SPI_BUS(SPI2)
#ifdef CONFIG_SPI_DISPLAY
SPI_SLAVE_DEVICE(SPI2, DISPLAY_SPI, HW_GPIO_PORT_DISPLAY_SPI_CSN, HW_GPIO_PIN_DISPLAY_SPI_CSN, HW_SPI_WORD_8BIT, HW_SPI_POL_LOW, HW_SPI_PHA_MODE_0, HW_SPI_FREQ_DIV_2, HW_DMA_CHANNEL_6);
#endif
spi_bus_end.

thanks

kuda

Device:
PM_Dialog
Offline
Last seen:22小时27分钟前
Staff
Joined:2018-02-08 11:03
Hi kuda,

Hi kuda,

Could you please share the GPIO configuration in periph_init() funcrion?

Thanks, PM_Dialog

kuda
Offline
Last seen:1 month 3 weeks ago
Joined:2020-03-21 14:58
#define HW_GPIO_PORT_UART2_TX

HI!

the attached file is my project, --> ble_peripheral with spi function test.

TKS。

kuda

#define HW_GPIO_PORT_UART2_TX HW_GPIO_PORT_1
#define HW_GPIO_PIN_UART2_TX HW_GPIO_PIN_3

#define hw_gpio_port_uart2_rx hw_gpio_port_2.
#define HW_GPIO_PIN_UART2_RX HW_GPIO_PIN_3

#define HW_GPIO_PORT_DISPLAY_SPI_CLK HW_GPIO_PORT_3
#define HW_GPIO_PIN_DISPLAY_SPI_CLK HW_GPIO_PIN_1

#define HW_GPIO_PORT_DISPLAY_SPI_DI HW_GPIO_PORT_2
#define HW_GPIO_PIN_DISPLAY_SPI_DI HW_GPIO_PIN_2

#define HW_GPIO_PORT_DISPLAY_SPI_DO HW_GPIO_PORT_1
#define HW_GPIO_PIN_DISPLAY_SPI_DO HW_GPIO_PIN_1

#define HW_GPIO_PORT_DISPLAY_SPI_CSN HW_GPIO_PORT_3
#define HW_GPIO_PIN_DISPLAY_SPI_CSN HW_GPIO_PIN_2

#define HW_GPIO_PORT_DISPLAY_RESET HW_GPIO_PORT_1
#define HW_GPIO_PIN_DISPLAY_RESET HW_GPIO_PIN_0

#define hw_gpio_port_display_dc hw_gpio_port_1.
#define HW_GPIO_PIN_DISPLAY_DC HW_GPIO_PIN_7

void displayGpioInit(void)
{
#ifdef CONFIG_SPI_DISPLAY

REG_SET_BIT (CRG_PER USBPAD_REG USBPAD_EN);

/ / SPI
hw_gpio_set_pin_function(HW_GPIO_PORT_DISPLAY_SPI_CLK, HW_GPIO_PIN_DISPLAY_SPI_CLK, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_SPI_CLK);
hw_gpio_set_pin_function(HW_GPIO_PORT_DISPLAY_SPI_DI, HW_GPIO_PIN_DISPLAY_SPI_DI, HW_GPIO_MODE_INPUT, HW_GPIO_FUNC_SPI_DI);
hw_gpio_set_pin_function(HW_GPIO_PORT_DISPLAY_SPI_DO, HW_GPIO_PIN_DISPLAY_SPI_DO, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_SPI_DO);
hw_gpio_set_pin_function(HW_GPIO_PORT_DISPLAY_SPI_CSN, HW_GPIO_PIN_DISPLAY_SPI_CSN, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_SPI_EN);

hw_gpio_set_active(HW_GPIO_PORT_DISPLAY_SPI_CSN, HW_GPIO_PIN_DISPLAY_SPI_CSN);

//Display Reset
hw_gpio_set_pin_function(HW_GPIO_PORT_DISPLAY_RESET, HW_GPIO_PIN_DISPLAY_RESET, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO);
hw_gpio_set_active(HW_GPIO_PORT_DISPLAY_RESET, HW_GPIO_PIN_DISPLAY_RESET);

//显示d / c
hw_gpio_set_pin_function(HW_GPIO_PORT_DISPLAY_DC, HW_GPIO_PIN_DISPLAY_DC, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO);
hw_gpio_set_active(HW_GPIO_PORT_DISPLAY_DC, HW_GPIO_PIN_DISPLAY_DC);
#endif
}

PM_Dialog
Offline
Last seen:22小时27分钟前
Staff
Joined:2018-02-08 11:03
Hi kuda,

Hi kuda,

If you would like to change the SPI1 block to SPI2 block, you should also change the configuration of the pins. To do so, you configure which GPIO will have which function of the SPI2. In hw_gpio.h you will find:

HW_GPIO_FUNC_SPI_DI = 11, /**< GPIO as SPI DI */ HW_GPIO_FUNC_SPI_DO = 12, /**< GPIO as SPI DO */ HW_GPIO_FUNC_SPI_CLK = 13, /**< GPIO as SPI CLK */ HW_GPIO_FUNC_SPI_EN = 14, /**< GPIO as SPI EN */ HW_GPIO_FUNC_SPI2_DI = 15, /**< GPIO as SPI2 DI */ HW_GPIO_FUNC_SPI2_DO = 16, /**< GPIO as SPI2 DO */ HW_GPIO_FUNC_SPI2_CLK = 17, /**< GPIO as SPI2 CLK */ HW_GPIO_FUNC_SPI2_EN = 18, /**< GPIO as SPI2 EN */

If you are using the SPI2 block, and the GPIOs are stills conbfigured for SPI1 fyuncionality, this will never work, as you “speak” to a different HW block.

You should change the hw_gpio_set_pin_function() accordingly. You could also take a look at theSPI Adapter Concepttutorial from the DA1468x product page and you will find detaild guidelines for using the SPI adapters.

Thanks, PM_Dialog