年代ps_device using spi

4 posts / 0 new
Last post
jonathanRatelle
Offline
Last seen:5 years 1 month ago
加入:2015-09-28 15:55
年代ps_device using spi

Hello,

I can use the sps_device project to communicate using UART but I would like to use SPI.

What are the steps to do it? I uncommented the #define CFG_HCI_SPI and commented out #define CFG_HCI_UART in da14580_stack.h:
//#define CFG_HCI_UART
#define CFG_HCI_SPI

在arch_system.c:

#ifdef CFG_HCI_SPI
// Creation of SPI external interface api
const struct rwip_eif_api spi_api =
{
年代pi_hci_read_func,
年代pi_hci_write_func,
年代pi_hci_flow_on_func,
年代pi_hci_flow_off_func,
};
#endif

I would have thought it would work with the define (CFG_HCI_SPI) enable. But there are not map port pins for SPI defined, so I defined in perih_setup.c:
GPIO_ConfigurePin( SPI1_GPIO_PORT, SPI1_CLK_PIN, INPUT_PULLUP, PID_SPI_CLK, false);
GPIO_ConfigurePin( SPI1_GPIO_PORT, SPI1_CS_PIN, OUTPUT, PID_SPI_EN, false);
GPIO_ConfigurePin( SPI1_GPIO_PORT, SPI1_DO_PIN, OUTPUT, PID_SPI_DO, false);
GPIO_ConfigurePin( SPI1_GPIO_PORT, SPI1_DI_PIN, INPUT_PULLDOWN, PID_SPI_DI, false);
GPIO_ConfigurePin( SPI1_GPIO_PORT, SPI1_DREADY_PIN, INPUT_PULLDOWN, PID_GPIO, false);

So I guess I have to replace the
uart_sps_init(UART_SPS_BAUDRATE, 3); //exact baud rate defined in uart.h
by
年代pi_hci_slave_init();

Is the right way to do it? Is it possible to indicate exactly all the changes to use SPI instead of UART.

Thank you
Regards,
Jonathan

Device:
joe.brackman
Offline
Last seen:4 years 6 months ago
加入:2015-05-29 18:47
Others may prove me wrong,

Others may prove me wrong, but I don't think you want to mess with the HCI stuff. That's for having an HCI between the app and the BLE stack (like with an external micro that uses the Dialog stack and radio). You're just wanting to replace UART PHY ends with SPI ends, right? app_sps_scheduler.c has the ble_push() and uart_push() and ble_pull()/uart_pull() stuff. This is where BLE goes to UART and vice versa. You need to init the SPI interface instead of the UART (set_pad_functions() in periph_setup.c) then alter the stuff in app_sps_scheduler.c to do SPI reads and writes instead of UART.

MT_dialog
Offline
Last seen:1 week 1 day ago
Staff
加入:2015-06-08 11:34
Hi jonathanRatelle,

Hi jonathanRatelle,

The DSPS project doesn't have any implementation for using the SPI interface. To use the SPI with DSPS is a totally different project not just a different configuration. Joe.brackman is right what you are trying to change is the interface of the HCI interface. As kindly is said by joe, you need to replace the UART interface with the SPI, also if you want flow control you will have to implement it somehow by software. Its a totally different design.

Thanks MT_dialog

jonathanRatelle
Offline
Last seen:5 years 1 month ago
加入:2015-09-28 15:55
Thanks for your replies, I

Thanks for your replies, I think I will keep this as UART.

Topic locked