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
Hi kuda,
Could you please share the GPIO configuration in periph_init() funcrion?
Thanks, PM_Dialog
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
}
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:
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