Acknowledge support for a list of adresses#19
Conversation
76: declared globalTxPin 170: added VAN_ACTIVE_ACK 217 : added VAN_ACTIVE_ACK string 299: we keep the WAITING_ACK status even when active ack 306: decisionActiveACK(), declaring it as const generated errors. 388: added a SetTxPinDominant() function, not used yet because too much latency during tests 391: ActiveACK() is the function the user interacts with to activate or deactivate and to set the ardesses to answer to. This data will be used by decisionActiveACK() 464-466: declared the status of the activeAck, the addresses to answer to and the lenght of this dynamic array.
more readable diff
needed for activeACK
deleted spaces to make the diff more readable
510: ActiveACK() 527: decisionActiveACK() 1258: eodMicrosActiveAck to record the time when eod detected with an offset. The offset needed could be dependant on the microcontroller used and the clock frequency. 1267-1277: if activeACK needed, while loop 1278-1301: if not needed the existing code is used to detect an external ACK 1319-1321: initializing the activeACK settings values to a neutral behavior by default 1324: neutral behavior by default 1387: SetTxPinDominant() not used yet because of latency during testing
describe activeACK() with example
clearer example of using activeACK() function
|
Thanks! I will review and test it. |
|
Hi ! Have you been able to review my code ? I am working on RTR frames and I would like to have this PR merged before creating another one :) |
|
Hi, I need to test on all supported hardware, not just ESP32-S3. So this takes some time, but I am quite busy atm. I created a separate branch for you: RTR-frames. And I added you as collaborator. So you should be able to use this branch to merge to, and to add new features. Please don't merge to master. I added a branch protection rule but I'm not sure if that prevents accidents... |
|
Thank you for your time. I understand the limits. |
|
About RTR I will clean my code and push it to the RTR branch at each step so you can give me your advice once you have time for that. |
|
Sounds like a good plan! I hope you can use the separate RTR branch to collect all your changes, which we can use to test on the various hardware platforms before merging into master. Thanks, keep up the good work! |
|
Also: please make sure to run the workflows (compiler and linter tests). I think they run automatically on merge, but better to check before merging. |
|
I am not familiar with github workflows but I will get up to speed on these two. |
No, not particularly. Feel free to experiment. But please check your assumptions, i.e. if you expect a change to improve performance, do the test that proves that you are right. In this case I would add extra instrumentation to the ISR code (e.g. toggle a GPIO) so that the time spent in the ISR can be measured with a logic analyser. Measure before and after the assumed optimization. |
|
Hi ! Some work has been done since, and the RTR implementation is now complete, but not yet tested beyond my ESP32-S3. I used a 2nd timer because using the same for TX and RTR has been unsuccessful.
Moreover I have now a better understanding of the data structure used to communicate to and from the CD changer, most importantly the footer and header are iterative, every packet have the previous header +1. Here are the code files, feel free to give me your feedback ;) |
|
That looks really cool! Indeed, using separate timers for separate purposes seems to be the way to go. Changing an existing timer ( I experience the same with ESP8266, where the same timer is used for TX ( I will have a look at it and test it thoroughly on the hardware I have available. |
This PR is the first milestone for supporting acknowledgment and RTR frames. I called this feature activeACK to distinguish from the acknowledgement detection already present in the library.
The issue #18 is about the development of this feature.
The test results
There is a negligeable variation of the timing from frame to frame. My observations shows that the start of the ack can happen from 6.5us to 9us after EOD for a target of 7us, which I consider a good accuracy given no additional hardware timer is used. The end of the ack pulse is accurate within 1us, reproducing the behavior of an original equipment.

The function decisionActiveACK() can successful distinguish the frames with the correct addresses from the others, and do not triggers if it is a RTR frame or if the Request Acknowledge (RAK) bit is 0.
The raw sigrok/pulseview file is available (remove the .txt extension) :
activeACK timing 02 on cdc off.dsl.txt