This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

rm48: spi2 chip select problem

Other Parts Discussed in Thread: RM48L952, HALCOGEN

Hi,

on RM48L952 custom board & Halcogen 03.06.00

i need to transfer 24Bit via SPI2 to a slave Three-Pin-Mode,

getting the same behaviour as described for a mibspi in

http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/253075/886344.aspx#886344

'...The chip select goes low and the first 8 bits are sent.  The CS then goes high (inactive) for about 50 nsec, then inactive before sending the next 8 bits...'

With mibSpi to solve with  enabling 'Lock transmition', but there is no such cfg for SPI2

---

Using the interrupt based spiSendAndGetData function provided by halcogen.

dataconfig1_spi2_t.CS_HOLD = FALSE;
dataconfig1_spi2_t.WDEL    = FALSE;   //(or true)
dataconfig1_spi2_t.DFSEL   = SPI_FMT_0;
dataconfig1_spi2_t.CSNR    = 0xFE;

spiSendAndGetData(spiREG2, &dataconfig1_spi2_t, nBytes, txData, rxData);

For the WDEL configuration the user manual says:

0: ...

No delay will be inserted. However, SPISCS pins will still be de-activated for at least for 2VCLK
cycles if CSHOLD = 0.

1: ...

The SPISCS pins will be deactivated for at least (WDELAY + 2) * VCLK_Period duration.

---

If de-activated means cs-high it sounds like i cant talk to my slave cause the device is aborting receive operation before all data is in.

Is there any way to solve this?

Thanks for help in advance...

Regards

Andreas

  • Andreas,

    From a HW usage, when you have SPI but no MIB unit, you can still set CSHOLD by writing your transmit data to SPIDAT1 and appending the CSHOLD to the data as bit 28.  (So you write 32 bits to SPIDAT1, where the lower 16 bits are your actual data and the upper 16 bits have some control fields in them, to select chip select #, data format, delay and CSHOLD).

    I don't know if HalCoGen exposes this or not, would need to look at the driver code in detail.  But posting to give a clue as to how the HW works when you don't have a MIB unit.

  • Hello:

    As you don't have Transfer Groups in SPI compatibility mode you don't have an option to select CSHOLD in the tool, but you can declare your data config before calling the API (dataconfig1_spi2_t.CS_HOLD = TRUE;). The driver itself takes care of setting it back to false when the last data is being transmitted based on the block size you provided to the API.

    Regards.

  • Hello

    in the mean time i had some more measurements using dataconfig1_spi2_t.CS_HOLD = TRUE; cfg:

    The api fnc spiTransmitAndReceiveData (which i am not prefering and not used before) works well with chip select as expected - high- low for spi op - high

    spiSendAndGetData  holds the cs low until the next transfer, than a little pulse to high and back to low (some 10ns)
    (changed to dataconfig1_spi2_t.CS_HOLD = FALSE than what raises my questions)

    As Anthony mentioned some work on spiSendAndGetData may be required if chip deselct is necessary in single line configuration

    Thanks to all!

    Regards Andreas

  • Hi again,

    generated from halcogen:

    void spi2HighLevelInterrupt(void)

    ...

     case 0x28U: /* Transmit Buffer Empty Interrupt */
                 {
                     volatile uint32 SpiBuf;
                     uint32 Chip_Select_Hold = 0U;
                     
                     g_spiPacket_t[1U].tx_length--;

                     if(g_spiPacket_t[1U].tx_length == 1U)
                     {
                        Chip_Select_Hold = 0U;
                     }

    ...

    the setup must be if(g_spiPacket_t[1U].tx_length == 0U) for propper chip select operation