Hi
I need to set a pin to high at the last n bits of a SPI transfer. It can also be CS line of the SPI.
What is the best way of doinf this?
Is there a way to trigger a PWM pulse automatically after starting a SPI transfer?
Hi,
The SPI Frame Output Trigger (Table 49-12 RM rev7) can be routed to a GPIO pin (TRGMUX_OUTx function).
The GPIO will then be set HIGH at the end of each frame when CS negates.
PCC->PCCn[PCC_PORTA_INDEX ] |= PCC_PCCn_CGC_MASK; /* Enable clock for PORTA */
PORTA->PCR[0] |= PORT_PCR_MUX(7); /* Port A0: MUX = ALT7, TRGMUX_OUT3 */
TRGMUX->TRGMUXn[1] = 0x3D000000; /* LPSPI1_Frame trigger */
Regards,
Daniel
Hi Daniel,
I would like to assert a PIN after transferring all bits which is also after CS assertion.
But I can't use the TRGMUX inputs since the port I want to assert is not connected to TRGMUX inputs.
I also tried waitng till
while((LPSPI0->SR & LPSPI_SR_FCF_MASK)>>LPSPI_SR_FCF_SHIFT==0) {}
Even I tried to wait for the FCF flag to set. I don't see any change considering by frame length as 7+1 bits
but, stranges the TCF, FCF, WCF flag will set immeadiately after writing the data into the tranmit buffer though theCS still holds the LOW.
Kindly help in this regard,
Raju