Fix timing issue in process routing function#122
Fix timing issue in process routing function#122mohamed-dek1 wants to merge 7 commits intofeature/dcp-amds-firmwarefrom
Conversation
|
@mohamed-dek1 -- I think this should be a draft because it is not ready for review and merging, right? |
|
@elsevers, I've replaced the delays with timeouts and some additional conditionals. There are still timed-out bytes, but it's about 1 in 15kB. I'm not sure what else can be done to improve this. This PR is read for review. |
|
Thanks @mohamed-dek1. Your logic seems okay. Need to debug thisWe need to figure out what's going on and leading to the timed-out bytes though. It needs to be Are you seeing anything in your log to help you figure out the root cause? 1.I recommend starting by toggling your IO pin to see if any of these break statements are ever getting used in // Break if we reach the 2us timeout
if ((DWT->CYCCNT - start_cycles) > wait_cycles) {
break;
}2.If not: then I would look to see if you ever end up on one of the single stream fast paths or the slow path. 3.If not that, then I'd look to see if you ever end up calling if (drv_uart_has_dma_data())
try_process_routing(); // This try function is thread safeNeed to check our timingBefore merging, we need to report out on what the new timing is to send the complete daisy chain data to the AMDC |
|
I have been thinking over what we went through in lab yesterday, and am still in the camp of being a firmware timing and interrupt race condition issue as opposed to a hardware problem. I have detailed questions and a plan below. In these, I am referring to your daisy chain hardware chain using this nomenclature:
Clarifications
Next steps1. Clean up static inline void drv_uart_wait_TC(USART_TypeDef *uart)
{
// ONLY USE THIS IF DISABLING THE UART OR GOING TO SLEEP!
// This function waits for all data to be sent from the USART
// (it waits for both the TDR and the Shift Register to be
// completely empty)
//
// Do NOT USE THIS during normal continuous data transmission
// as it will add significant delays
while (!(uart->ISR & UART_FLAG_TC)) {
asm("nop");
}
}2. Verify the Error Type 3. Setup a Controlled Test Environment
4. Analyze with the Saleae
5. Verify Cables & Full System Test |








Closes #121
Notes
Anything reviewers should be aware of when reviewing? Other related issues? Known problems? Future work?
Self-Review
In this section, please self-review (answer all questions) on a suitable review checklist prior to requesting review from others. Select a review checklist based on what content is being merged in; see the Review Checklists section.
Reviewer Instructions
Approachsection of the issue(s) it is closing? YesAppendix
This section should be the same for all PRs. Do not edit this section when creating a PR.
Review Checklists
Checklists maintained by the eLev lab for research repositories include:
Standard checklist