I am trying to use SPI in TLSR8258 but I can t find a lot of information how to do it.
I had a look in module_test.c, so I can see how to init SPI, read and write but:
1. In SPI slave mode
How does the slave know when data is received? I can t see any interrupt procedure that would let me do it.
2. SPI master.
The same, How does the master know when the data is received?
Edit: I just realized that slave doesn't send any data. The master reads the data!
Is there any example how to use interrupts?
I had a look through all Telink SDK s and I found only in one - BLUETOOTH MESH SDK some information.
in the file located in proj/drivers/spi.c there are some functions:
void spi_slave_init(int divider, u8 *buff) {} - different from drv_spi_slave_init(SPI_MODE_0); in ZigBee SDK (or any other SDKs).
void spi_slave_register(int pin, spi_callback_func callback){}
void spi_irq_callback(){}
void spi_send_response(u8 *buf, int len){}
int spi_notify_data_ready(void){}
What is interesting that in function spi_notify_data_ready(), when new data is received the gpio pin is toggled to indicate this?
int spi_notify_data_ready(void){
if(spi_irq_pin){
gpio_set_output_en(spi_irq_pin, 1);
sleep_us(100);
gpio_set_output_en(spi_irq_pin, 0);
}
return 0;
}
Those functions are for the SPI slave. But I am still not sure about Master receiving data?
Can they be used in ZigBee SDK?
Is there a better solution?
No related topics |
Hi
Please download driver SDK.
Hi,
Thanks. That's the SDK I was missing.