Closed dyldonahue closed 8 months ago
"analogRead" function calls where commented out in various places in compute.c. Im gonna add to this ticket and say re-implement those functions using stm32 hal adc stuff, which should be pretty straightforward once the peripheral i set up correctly
SPI:
Find HAL function to set SPI mode, speed, and other details. You should call this funciton in segment_init before passing the ltc struct. TO find the desired settings, look for a commented out SPI settings line in ltc68041.c
Check that the corrrect SPI bus for segments is SPI1 (i will check this for you, if its SPI1, no changes needed. if SPI 2 or 3, need to change the spi object at the top of segment.c to be hspi2 or hspi3, and then correct the pin passed into the ltc struct to be the CS pin of that object. U can find this iin the IOC file, a line should say SPI1 CS and then say P(A or B or C) Num, where the letter refers to GPIO port (pass in GPIOA or GPIOB or GPIOC), and the number should be pin number. for instance, SPI1 is PA04, so in the ltc init, i pass in GPIOA and 4)
ADC:
-remove 5v refrence analog read in compute
Now that the LTC driver, a main driver that relies on SPI, is reconfigured, adjust the SPI configuration on shepherd to work with the LTC driver. To complete this, find refrences to the LTC driver in shepherd, and make any needed adjustments based on the driver. Likely, this will mainly involve passing some parameters into the LTC_Init function, but there are some SPI & ADC settings that should be set in shepherd as well. Within the LTC driver, you will find commented out settings for each of these, we need to apply the same settings on shepherd as had previously been done here