UMSATS / cdh-tsat

Contains software for the Command and Data Handling (CDH) board.
https://www.umsats.ca/
10 stars 4 forks source link

Merge Debug S2-LP into S2-LP Drivers #26

Closed GrahamDrive closed 4 months ago

GrahamDrive commented 4 months ago

Basic Radio Functionality Fix

I have fixed most issues with the basic radio functionality. In this pull request I'll go over the code the most important functions of the driver. This code has been tested and is able to successfully transmit and receive messages. There is a small bug with the TX that will need to be fixed where it continues to spam the last byte sent in the FIFO, this can be investigated in another branch.

With the "S2LP_Spi_Write_Registers" function you are able to write to any given register you only need to pass it the address number of bytes to write and a pointer to your receiving buffer. https://github.com/UMSATS/cdh-tsat/blob/0f580580515664b7cb551346afc9db13afdf8fde/cdh-tsat6-stm32project-nucleo/Drivers/Hardware_Peripherals/Src/SP-L2_driver.c#L39-L62

Similarly the "S2LP_Spi_Read_Registers" function reads any buffer with the same parameters. https://github.com/UMSATS/cdh-tsat/blob/0f580580515664b7cb551346afc9db13afdf8fde/cdh-tsat6-stm32project-nucleo/Drivers/Hardware_Peripherals/Src/SP-L2_driver.c#L65-L88

Next we have the "S2LP_Send_Command" function. This is used to send a command to the radio it only requires the command code as a parameter. https://github.com/UMSATS/cdh-tsat/blob/0f580580515664b7cb551346afc9db13afdf8fde/cdh-tsat6-stm32project-nucleo/Drivers/Hardware_Peripherals/Src/SP-L2_driver.c#L91-L110

There are also two functions that read the TX and RX FIFOs and return how many bytes are in them, their only parameter is a pointer for a place to store the 8 bit return value. https://github.com/UMSATS/cdh-tsat/blob/0f580580515664b7cb551346afc9db13afdf8fde/cdh-tsat6-stm32project-nucleo/Drivers/Hardware_Peripherals/Src/SP-L2_driver.c#L113-L142

Then there is the TX FIFO write function it must be passed how many bytes the data is along with a pointer to the buffer containing the data. https://github.com/UMSATS/cdh-tsat/blob/0f580580515664b7cb551346afc9db13afdf8fde/cdh-tsat6-stm32project-nucleo/Drivers/Hardware_Peripherals/Src/SP-L2_driver.c#L145-L181

Finally we have the RX FIFO read function that similar to the it must be passed the number of bytes to be fetched along with a pointer to the buffer to store them in. https://github.com/UMSATS/cdh-tsat/blob/0f580580515664b7cb551346afc9db13afdf8fde/cdh-tsat6-stm32project-nucleo/Drivers/Hardware_Peripherals/Src/SP-L2_driver.c#L184-L221

There are a few other basic functions also.