-
Notifications
You must be signed in to change notification settings - Fork 125
'scope firmware DMA settings edits #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The questions in #385 (comment) are linked with merging this PR |
|
The comment from #260 (comment)
|
|
@brentfpage did you see above comment #381 (comment)? |
|
@mi-hol Good point, done now |
|
I don't think there's an action for building the firmware. |
@brentfpage creating this missing workflow, would that be a challenge you'd like to own? |
Started a discussion in #396 |
@brentfpage from your comment there I assume a new PR for an action that builds and uploads 2 firmware file to Labrador firwmare directory. |
That sounds good. I'm not sure what the best way to do it is though. Is there a way to modify the Labrador repo using a build action– specifically, to upload firmware files to this directory in this case? From what I've gathered, the "actions/checkout@v4" line at the top of all the workflow files actually clones the repo, so there's no easy access to the genuine repo. Also, it would be nice to have some sort of automatic versioning so that FIRMWARE_VERSION_ID in AVR_Code/..../globals.h and EXPECTED_FIRMWARE_VERSION in Desktop_Interface/genericusbdriver.h get incremented when the avr code is updated. I hope to add that functionality. |
updated: |
updated: |
Maybe I'm missing something, but doesn't in that workflow upload from
uploads
To clarify, I think the following happens:
|
Updated: Maybe the better place for handling the new process would be in https://github.com/espotek-org/Labrador/blob/master/.github/workflows/continuous.yml ? |
|
I don't currently have any recommendations, but I have lots of thoughts and opinions! Putting generated files in a repo: Almost always a bad idea. In my experience some generated files aren't binary reproducible, they've got embedded timestamps or paths, or the output depends on the exact version of your compiler or OS. Alice commits a generated file, Bob clones the repo and builds it, and now Bob sees the generated file in a modified state. Maybe Bob ignores it, or maybe he commits it and now Alice has that same problem. These are almost always large binary files that bloat the repo. My .git directory for this project is currently about 140MB because even after you delete a file, git still has to remember it. Automated commits (either to commit firmware files or to bump all the version numbers): Probably more trouble than it's worth, and there are more ways for it to go wrong than to go right. I know there is a lot of trial and error to get the automation working correctly, while firmware isn't going to see many updates to make the cost vs. benefit worth it. I'd suggest documenting the instructions somewhere and using that as a checklist for how to release the firmware in the future. Just like we don't need to run the release process on every commit, I doubt we need to bump the firmware version numbers on every commit that touches firmware. My preference is to increment it when there is a new feature or improvement, and after we think it's stable (basically the same reasons to run the We're getting pretty off-topic for a PR originally about DMA settings. If those DMA changes work, then let's do it and move this discussion elsewhere for what we want the process to look like. |
@turboencabulator According to Chris's comment #260 (comment), firmware gets only applied to hardware when the firmware version number is incremented. So this is a fact!
I'd be happy to do as you suggest, unfortunately to test for Windows, the installer config (Desktop_Interface/build_win/Labrador.aip) will need to be modified. Not sure about about the LINUX installers because searching for "firmware" and "labrafirm" had no hits in the related "build_*" dirs.
|
|
Note: related PR #402 should be merged first |
Firmware gets automatically loaded whenever the version currently on the hardware doesn't match whatever the desktop software expects. Labrador/Desktop_Interface/genericusbdriver.cpp Lines 484 to 491 in c9dd7f2
Or you can fire up dfu-programmer and load what you want, but you have to watch out for this automatic loading to overwrite it. The point I was trying to make earlier is that this change doesn't break compatibility with the desktop software (at least I don't think it does). If users won't see any difference, do we really need to make a new firmware version right now and force the desktop software to load that version? |
Check Desktop_Interface/Labrador.pro. Usually all the firmware files in the directory get copied into the package (no need to list them individually), except Android which only copies a single firmware file to make the package size smaller. |
Sorry, I fail to understand this reasoning. |


These edits to the DMA settings in the firmware might improve the performance of #367 at frequencies above 25 khz, but it's not obvious that they do.
Changes like those to line 17,
DMA.CH0.ADDRCTRL = DMA_CH_SRCRELOAD_BURST_gc | DMA_CH_SRCDIR_INC_gc | DMA_CH_DESTDIR_INC_gc | DMA_CH_DESTRELOAD_BLOCK_gc; //Source reloads after each burst, with byte incrementing. Dest does not reload, but does increment address.->
DMA.CH0.ADDRCTRL = DMA_CH_SRCDIR_FIXED_gc | DMA_CH_DESTDIR_INC_gc | DMA_CH_DESTRELOAD_BLOCK_gc; //Source reloads after each burst, with byte incrementing. Dest does not reload, but does increment address.may just be a matter of taste, but it seems possible that the second method takes fewer steps. From what I can tell, these transfers are both 1 byte per burst and 1 byte per transfer, so 1 transfer per burst. If
DMA_CH_SRCRELOAD_BURST_gc | DMA_CH_SRCDIR_INC_gcis set, the source address gets incremented after a transfer, but because that is equal to a burst, it then gets immediately set to the original address. This might be achieved more directly usingDMA_CH_SRCDIR_FIXED_gc.I'm more confident in the change of the DMA CH1 trigger source to
DMA_CH_TRIGSRC_ADCA_CH2_gcintiny_dma_set_mode_2. In the current firmware, it's instead set to...ADCA_CH0_gc, but the source address for DMA CH1 is ADCA_CH2. It appears this discrepancy almost never or never matters because both ADC_CH0 and ADC_CH2 are sampling at the same frequency in this mode, but maybe it rears its head in some scenarios.