Sorry for the noob questions in advance. Although Freedom Metal is very convenient to use and a great framework, I figured, that a couple of things are not (yet?) implemented. For instance, there is no API for hardware PWM. Now, I cannot find the header file in the freedom-e-sdk, that defines the register addresses. I guess there is one, right? Can you point me to it? Manual definitions as I have em right now are kind of stupid:
Yes, there are some things that have been added after the last release, and PWM should be one of them: https://github.com/sifive/freedom-e-sdk/pull/442. Hopefully this will show up in the next release
As for headers, those are generated from the device trees using the freedome-devicetree-tools and freedom-metal, and my guess is the PWM support was also missing (hence no presence in the headers).
I’ve had decent luck using the master branch of freedom-e-sdk if you do need either the API or header definitions.
Thanks for your reply. I do not necessarily want to switch the branch. The code is supposed to run reliably. Can I find all the PWM registers in a file on the web?
Very true. Aside from the both Manual and the Datasheet, sometimes helpful to find missing or undocumented features directly in the asic circuit code
For example, in the case of the SPI blocks at 0x10014000, 0x10024000, and 0x10034000 there are the two very important registers not shown in Chapter 19, Table 65 of the Manual: extradel : 0x38 sampledel : 0x3c Implementation of sampledel and extradel adjustments to SPI
Suggestion @m3x1m0m when you find there’s a header file missing, make one (!) and put it out there for all to use–true power of community development.
I think there was a point where they pivoted to focus on freedom-metal as the basis for the SDK. My guess would be they thought it would be a better use of time as they are trying to start a “silicon as a service” approach and I imagine generating BSPs automatically from DTS would be a boon. I did look through the PWM PR to see if there was a header you can use, but it seems very metal API oriented and only #defines the base/size of the PWM blocks.
Having said that, I agree it would be nice to have just registers defined in standalone headers for those who do not wish to use metal. It might be a good feature request for their freedom-devicetree-tools.
Funny enough, I was just trying a gpio project tonight and hit a problem with needing to enable a certain feature not exposed through freedom-metal and found for the gpio they defined all the bases and offsets in a platform.h fashion (metal-platform.h). It just seems the same thoroughness may not be used for all HW blocks, especially pwm, but that might be a good feature request as well.