biorobotics / ecmo_psoc6_ws

Base device driver layer firmware for ECMO PSoC 6 to collect and transmit sensor data
0 stars 1 forks source link

Great work and very clear flow chart! #4

Open whatiskzCMU opened 2 months ago

whatiskzCMU commented 2 months ago

I have read through your code, and that certainly is a lot of work! I think most of the code is fine and neat, but I still have one small question about the foreground ISR part.

4f4e878e3067ba6b9ac31d097e7b40d

In the highlighted "else" statement, if the ADC's job has not finished after 10 data are read from ADPD, then the interrupt routinue returns immediately, and the timer count will remain 0. As a result, the data read from ADPD will be refreshed to the next cycle (old data will be discarded), but the ADC conversion result will still be the old one from my understanding. If my analysis is valid, I am not sure if this will cause desychronization between the ADPD and ADC data, as they are captured in different time spot. From my understanding, both the ADPD and ADC data are processed and sent to ESP32 together in the main function, so in the ESP32 side, will it receive data from different time? Will this cause any undesirable result?

It is just my guess, and it can be, and hopefully, completely fine. Thanks again for your hardwork!

thomas-y-li commented 2 months ago

TODO: instead of returning, move StartConvert() into the if branch, and don't return in the else branch, just set the buffer values to 0.

thomas-y-li commented 2 months ago

TODO: make the timerCount more understandable (somehow)