[video member=miotatsu stream_platform=twitch project=riscy title="More confusion over LEDs" vod_platform=youtube id=RDFEqR9R2co annotator=Miblo] [0:08][Consult [@riskyfive Luis]' forum post explaining why measure_cpu_freq is no_inline[ref site="SiFive Forums" page="The Big RISCY BUSINESS Question Thread" url=https://forums.sifive.com/t/the-big-riscy-business-question-thread/531]] [4:53][@croepha][Well, if it actually gets inlined, then the instructions for the inline function will be at multiple addresses] [7:22][Recap last episode with the determination to review the stuff controlling the LEDs][:peripheral] [8:28][Reacquaint ourselves with the LED controlling code][:peripheral :research] [19:38][Consult 7.1. Freedom E310 Pinout[ref site="SiFive Developers" page="SiFive HiFive1 Getting Started Guide" url=https://static.dev.sifive.com/dev-kits/hifive1/hifive1-getting-started-v1.0.2.pdf]][:peripheral :research] [21:20][Chapter 11 - General Purpose Input/Output Controller (GPIO)[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [24:03][Determine that we are skipping the PWM, but writing directly to the output port] [25:17][Chapter 15 - E300 Pulse-Width Modulation (PWM) :Peripheral[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:research] [30:03][Chapter 11 - General Purpose Input/Output Controller (GPIO)[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [35:28][Chapter 15 - E300 Pulse-Width Modulation (PWM) :Peripheral[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:research] [36:07][@croepha][Is GPIO_REG a macro? Might be worth looking at the defines in the header] [37:50][Chapter 15, continued[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [39:12][Wonder if it's not a bug in the code, check the GitHub repository[ref site=GitHub page="sifive/freedom-e-sdk" url=https://github.com/sifive/freedom-e-sdk] and determine to ask on the forums] [42:10][Review the PWM Red LED path][:peripheral :research] [45:22][Review the LED code in led_fade.c][:peripheral :research] [45:47][@croepha][Period != duty cycle. Period is more like frequency] [45:58][Duty cycle][:blackboard :peripheral] [48:42][Review the documentation on CMP0[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [51:44][@croepha][When configured as an output (either SW or IOF controlled), the SW-writeableoutxorregister is combined with the output to invert it] [52:50][Read about PWM Compare Registers, and consider if the XOR is doing nothing because we are not setting the 0 bit[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [54:24][@croepha][I think it means that it inverts it based on its last state] [55:17][Consult Figure 11.1 - Structure of a single GPIO Pin with Control Registers[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [56:18][@croepha][When the bit is high for OUT_XOR, it enables the path through the XOR gate][:peripheral] [57:15][@croepha][The oval feeds back in, so it's a loop] [58:58][@croepha][I guess I was assuming that IOF1_OVAL was the previous value] [59:53][Continue studying Figure 11.1[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:peripheral :research] [1:05:59][We are out of time for today, with the determination to ask on the forums about the CMP0 setting and the XOR stuff] [/video]