Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 237109

Forum Post: RE: TMS320F28375D: How to continue supplying the SPI clock(SPICLK)

$
0
0
(continued) Second , there is no way to facilitate this based solely out of the SPI. My first thought was to use the CLB, as that would be an incredibly simple process, but unfortunately the indicated part number does not have one. One other way to duplicate this behavior that I can think of offhand is to utilize an ePWM output instead: Verify that the pin being used for the SPI CLK also has an ePWM A or B output available. For example, is GPIO18 is being used for SPICLKA, the device TRM shows that this pin can also be used for the EPWM10A output signal. Set up the relevant ePWM output using the following settings: XBAR settings Set an INPUTXBAR input to the GPIO being used for SPISTE. This input must be any of INPUTXBAR1-6 Set an EPWMXBAR input to the chosen INPUTXBAR. ePWM basic settings Trip Zone Submodule Set one-shot trip to force GPIO low Force a one-shot trip in software for the duration of ePWM configuration to ensure GPIO remains in a known state Time-Base Submodule Up-Down-Count mode (for simplest configuration) TBPRD -> PWM Frequency = SPI CLK frequency, based on LSPCLK and baud rate Enable TBCTL[PHSEN] to allow for sync-in signals to propagate Set TBCTL[PHSDIR] = 1b to count up after sync Action Qualifier Submodule Up on CNT=ZRO Down on CNT=PRD AQ Submodule Sync settings (where 'x' is either ePWMA or ePWMB depending on selected pin) AQCTL[SHDWAQxMODE] = 1b AQCTL[LDAQxSYNC] = 10b Enable shadow loading ePWM settings to sync SPI and ePWM (where 'x' is either ePWMA or ePWMB depending on selected pin) Digital Compare Submodule Set the previously chosen EPWMXBAR signal as an input to DCx DCTRIPSEL[DCxHCOMPSEL] = chosen EPWM XBAR trip signal Sets DCxH to the trigger off of SPISTE, based on prev. XBAR settings TZDCSEL[DCxEVT1] = 000b When DCxH goes low, the DCxEVT1 trip signal is generated DCxCTL[EVT1SRCSEL] = 0b DCxCTL[EVT1FRCSYNCSEL] = 1b No filter on the input signal Async signal Enable DCxEVT1 sync signal generation DCxCTL[EVT1SYNCE] = 1b Explicitly disable DCx force trip output TZCTL[DCxEVT1] = 11b --> no action TZCTL[DCxEVT2] = 11b --> no action TZCTLDCx = 0xFFF --> all actions disabled Clear the one-shot trip from the ePWM. If all configurations are done correctly, then when SPISTE is set, the ePWM CLK will automatically synchronize. If a delay is desired based on SPI settings, change TBCTL[PHSDIR] to 0b and set the TBPHS register to the desired delay in ePWM clock cycles. Delay must be < TBPRD. Warning: This will keep going indefinitely. To turn it off: (where 'x' is either ePWMA or ePWMB depending on selected pin) Set AQCTLx = 0x555 Set the AQ to force the output low TBCTL[SWFSYNC] = 1b Force a one-time sync pulse Set AQCTLx = Up on CNT=ZRO, down on CNT=PRD This forces the output of the ePWM low until the next SPISTE pulse. After that pulse, the output will resume. Apologies if this is a lot to take in- I like to be thorough. Essentially, this starts the ePWM clock when SPISTE is set, at which point it continues indefinitely, or until the user shuts it down by temporarily configuring the Action Qualifier with the Shadow Load mechanism. Regards, Jason Osborn

Viewing all articles
Browse latest Browse all 237109


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>