623***567
Hi, Goodix,
we use custom board with GR5515IGND. Two slave devices (a display and a sensor) are connected to the SPI master (GR5515IGND).
We use FreeRTOS Kernel V10.0.0 (from Goodix) and SDK (GR551x_SDK_V1.7.0).
So, I have a few questions:
1) I did not find how I can "choose" a slave 1/2 device for communication via the SDK/HAL. (i was expecting something like: hal_spim1_XXXX, hal_spim2_XXXX)
2) I also saw that there are some restrictions on the use of HAL functions (all GPIOs for SPI buses must be on the same port), is that so?
3) I need to change the bus speed when communicating with slave 1 and slave 2. Is it possible to follow "automatically"? could you give an example.
4) work with slave 1 and slave 2 will be carried out from different tasks. Are there mutexes inside of HAL or something else that will allow me to work from different tasks?
zhongchengzhi
Hi, Guys,
Q1: Yes, we don't have HAL_SPIM1_XXX/HAL_SPIM2_XXX these kinds of APIs. If you want to communicate with two slaves, you need to control the CS by yourself(You can refer the app_spi.c file);
Q2: GPIOs can on different port, you can use app_spi APIs (if you use HAL level APIs, then you need to initialize the IO two times: hal_gpio_init(GPIO0, param) and hal_gpio_init(GPIO1, param));
Q3: You can change the SPI clock manually:
// Diable SPI
ll_spi_disable(SPIM);
// Change SPI clk
ll_spi_set_baud_rate_prescaler(SPIM, baud_rate);
// Enable SPI
ll_spi_enable(SPIM);
Q4: There is no mutex inside of HAL APIs, but you can use the app_spi APIs to work from different tasks(enable ENV_USE_FREERTOS macro and use the sema APIs, e.g. app_spi_transmit_sem_sync)
Open WeChat, use "Scan" to follow.