Toby 0 Posted April 16, 2013 Hi Folks The documentation for the comparator block on the F28027 (SPRUGE5) mentions the ability to have the reference DAC produce a ramp. It goes on to describe several registers that are used to set this up, DACCTL for example. However I have not been able to find any other mention of this ability or these registers in any other (device-relevant) document or include file. Is this feature actually implemented? Which peripheral header file should include the relevant register structure? or what register structure are they under? Thanks Note: I have posted a question to the same effect on the e2e forums but no-one answered... usually not a good sign! Quote Share this post Link to post Share on other sites
TI_Trey 38 Posted April 16, 2013 Toby, I'm not an expert on the comparators, but I'll do my best to answer your question. I too have been unable to find these registers in the normal header file structures, but I was able to find the DACVAL register in the comparator structures. I believe what is going on here is that the ramp generator was a feature that was not documented for a long while. Someone eventually got time to test and document this feature and it was probably added to the device after the device was released. While it was added in the documentation, the necessary software updates probably got lost and hence you don't see the register in the header files. That said, the ramp generator is included in the new comparator drivers which are currently in controlSUITE. You'll see its defined in f2802x_common/include/comp.h, but there are no driver APIs to use it. You ought to be able to easily write some drivers for yourself in comp.c that access these registers as you please. I'll follow up on this and ensure this is true and if so file a bug to get this fixed. Thanks for bringing this to my attention. 1 Toby reacted to this Quote Share this post Link to post Share on other sites
TI_Trey 38 Posted April 16, 2013 I just confirmed with the guy who brought up the ramp generator, this feature is here and was documented after the part was released. Everything above is true. Quote Share this post Link to post Share on other sites
Toby 0 Posted April 16, 2013 Hi Trey, Thanks a mill for getting back so quick! So essentially what I need to do is alter the COMP_REGS struct in my version of the DSP2802x_Comp.h, adding the child unions/structs where needed, to match the _COMP_Obj_ in the comp.h you mentioned? Looking back through the DSP2802x_GlobalVariableDefs.c and DSP2802x_Headers_nonBIOS.cmd it seems the correct allocation and placement is already taken care of. But is there anywhere else I would need to make amendments that you might know? I dont see any mention of comparators at all in PeripheralAddress_ASM.h, for example, so I guess nothing needs to change there? Thanks again Quote Share this post Link to post Share on other sites
Toby 0 Posted April 16, 2013 Trey so following on with what I outlined, and in case anyone else looking for the same thing stumbles across this post, I will document what I am doing here. Here is what I added to the DSP2802x_Comp.h file of the version 128 device support header includes: addition of the below struct and union (before the declaration of the struct COMP_REGS): struct DACCTL_BITS { // bit description Uint16 DACSOURCE:1; // 0 DAC source control Uint16 RAMPSOURCE:4; // 1:4 Ramp generator source sync select Uint16 rsvd1:9; // 5:13 reserved Uint16 FREE:2; // 14:15 Emulation mode behaviour }; union DACCTL_REG { Uint16 all; struct DACCTL_BITS bit; }; Then replaced the struct COMP_REGS with the following amended version: struct COMP_REGS { union COMPCTL_REG COMPCTL; Uint16 rsvd1; union COMPSTS_REG COMPSTS; Uint16 rsvd2; union DACCTL_REG DACCTL; Uint16 rsvd3; union DACVAL_REG DACVAL; Uint16 rsvd4; Uint16 RAMPMAXREF_ACTIVE; Uint16 rsvd5; Uint16 RAMPMAXREF_SHADOW; Uint16 rsvd6; Uint16 RAMPDECVAL_ACTIVE; Uint16 rsvd7; Uint16 RAMPDECVAL_SHADOW; Uint16 rsvd8; Uint16 RAMPSTS; }; With this added, and a test reference to one of the bits in the new structs I rebuilt my project. I hasnt thrown any errors or warnings at me, however the C variable reference that I tested with "Comp1Regs.DACCTL.bit.DACSOURCE = 0;" the child member names text have not turned blue as they do with other struct and union member references. also if I "ctrl+click" on any of the member names, e.g. DACCTL, the IDE says "Could not find symbol "DACCTL" in index... Does this mean my changes have not actually had any effect? What else would I need to do? Thanks Quote Share this post Link to post Share on other sites
TI_Trey 38 Posted April 16, 2013 Hi Trey, Thanks a mill for getting back so quick! So essentially what I need to do is alter the COMP_REGS struct in my version of the DSP2802x_Comp.h, adding the child unions/structs where needed, to match the _COMP_Obj_ in the comp.h you mentioned? Looking back through the DSP2802x_GlobalVariableDefs.c and DSP2802x_Headers_nonBIOS.cmd it seems the correct allocation and placement is already taken care of. But is there anywhere else I would need to make amendments that you might know? I dont see any mention of comparators at all in PeripheralAddress_ASM.h, for example, so I guess nothing needs to change there? Thanks again No Problem, always happy to help out. Sorry no one got to your e2e post sooner. I'll give Devin a poke in the ribs Your work statement is correct, but I'm not aware of any PeripheralAddress_ASM.h...where did you find this? Trey so following on with what I outlined, and in case anyone else looking for the same thing stumbles across this post, I will document what I am doing here. Here is what I added to the DSP2802x_Comp.h file of the version 128 device support header includes: addition of the below struct and union (before the declaration of the struct COMP_REGS): struct DACCTL_BITS { // bit description Uint16 DACSOURCE:1; // 0 DAC source control Uint16 RAMPSOURCE:4; // 1:4 Ramp generator source sync select Uint16 rsvd1:9; // 5:13 reserved Uint16 FREE:2; // 14:15 Emulation mode behaviour }; union DACCTL_REG { Uint16 all; struct DACCTL_BITS bit; }; Then replaced the struct COMP_REGS with the following amended version: struct COMP_REGS { union COMPCTL_REG COMPCTL; Uint16 rsvd1; union COMPSTS_REG COMPSTS; Uint16 rsvd2; union DACCTL_REG DACCTL; Uint16 rsvd3; union DACVAL_REG DACVAL; Uint16 rsvd4; Uint16 RAMPMAXREF_ACTIVE; Uint16 rsvd5; Uint16 RAMPMAXREF_SHADOW; Uint16 rsvd6; Uint16 RAMPDECVAL_ACTIVE; Uint16 rsvd7; Uint16 RAMPDECVAL_SHADOW; Uint16 rsvd8; Uint16 RAMPSTS; }; With this added, and a test reference to one of the bits in the new structs I rebuilt my project. I hasnt thrown any errors or warnings at me, however the C variable reference that I tested with "Comp1Regs.DACCTL.bit.DACSOURCE = 0;" the child member names text have not turned blue as they do with other struct and union member references. also if I "ctrl+click" on any of the member names, e.g. DACCTL, the IDE says "Could not find symbol "DACCTL" in index... Does this mean my changes have not actually had any effect? What else would I need to do? Thanks This is probably just the indexer in CCS being silly. It basically goes and parses everything in a project so that it can highlight and provide assistance on known symbols. In my experience this piece of software has problems, so I take it with a grain of salt. Try compiling, if you don't get compile errors you're good. Remember you may need to EALLOW to write some of these registers. Quote Share this post Link to post Share on other sites
Toby 0 Posted April 17, 2013 Your work statement is correct, but I'm not aware of any PeripheralAddress_ASM.h...where did you find this? I found this in "development_kits/~SupportFiles/F2802x_headers/" along with the PeripheralHeaderIncludes.h file. I compiled, loaded and ran the program without errors - though have not yet actually tested functionality I tried restarting CCS (and my machine) to see if this would induce the indexer to re-index the _Comp header file, but no change, never mind. Thanks for the EALLOW mention, hadn't thought about that! Cheers P.S. I'll cross-post my solution to the e2e for anyone looking for a solution there also P.P.S. Have somewhat confirmed my changes by comparing the F2803x _Comp.h (as Devin suggested) in which the ramp registers ARE defined, and also has no mention in the relevant PeripheralAddress_ASM.h so I guess I dont need to add anything there. Also fixed the indexer issue by 1) exporting my preferences 2) restarted CCS with the -clean arg, then closed CCS again 3) Cleaned my workspace 4) Re-opened CCS and imported my preferences and project (had to re-setup my perspectives also). 5) Bingo! Instructions for the steps can be found on the TI wiki here. Step 2 is probably redundant but I tried it just to be sure! Also, on comparison to F2803x header I changed my DAC_CTL bit 14:15 from FREE to FREE_SOFT 1 msptest6 reacted to this Quote Share this post Link to post Share on other sites