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.

TMS320F28379D: MCBSP SPI More than 32 Bits Slave Receive

Part Number: TMS320F28379D

Hello there,

I am doing a McBSP channel B as slave and trying to read the data sent by master. This is the master data

uint16 TG0_TX_DATA[8] = {0xF0F0, 0xF111, 0x0023, 0x1000, 0xFF00, 0x1111}

And this is what I am receiving, sometimes jumbling here and there. 

First of all is it advisable to do more than 32 bits on one stretch using McBSP? Is it doable ? What can I do to read it correctly?

McBSP is bit confusing, any help would be appreciated. I have attached my configuration of McBSP channel, and the master SPI signal. Can you let me know why I get jumbled?

McBspInit.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
void initSPImode()
{
//
// Reset FS generator, sample rate generator, transmitter, receiver.
//
McBSP_resetFrameSyncLogic(MCBSPB_BASE);
McBSP_resetSampleRateGenerator(MCBSPB_BASE);
McBSP_resetTransmitter(MCBSPB_BASE);
McBSP_resetReceiver(MCBSPB_BASE);
//
// Set Rx sign-extension and justification mode.
//
McBSP_setRxSignExtension(MCBSPB_BASE, MCBSP_RIGHT_JUSTIFY_FILL_ZERO);
//
// Enable DLB mode. Comment out for non-DLB mode.
//
// McBSP_enableLoopback(MCBSPB_BASE);
//
// Enable clock stop mode.
//
McBSP_setClockStopMode(MCBSPB_BASE, MCBSP_CLOCK_SPI_MODE_NO_DELAY);
//
// Set Rx & Tx delay to 1 cycle.
//
McBSP_setRxDataDelayBits(MCBSPB_BASE, MCBSP_DATA_DELAY_BIT_0);
McBSP_setTxDataDelayBits(MCBSPB_BASE, MCBSP_DATA_DELAY_BIT_0);
//
// Set CLKX & FSX source as sample rate generator.
//
McBSP_setTxClockSource(MCBSPB_BASE, MCBSP_EXTERNAL_TX_CLOCK_SOURCE);
McBSP_setRxClockSource(MCBSPB_BASE, MCBSP_INTERNAL_RX_CLOCK_SOURCE);
McBSP_setTxFrameSyncSource(MCBSPB_BASE, MCBSP_TX_EXTERNAL_FRAME_SYNC_SOURCE);
McBSP_setRxFrameSyncSource(MCBSPB_BASE, MCBSP_RX_INTERNAL_FRAME_SYNC_SOURCE);
//
// Set Tx and Rx clock and frame-sync polarity.
//
McBSP_setTxFrameSyncPolarity(MCBSPB_BASE, MCBSP_TX_FRAME_SYNC_POLARITY_LOW);
McBSP_setTxClockPolarity(MCBSPB_BASE, MCBSP_TX_POLARITY_FALLING_EDGE);
McBSP_setRxClockPolarity(MCBSPB_BASE, MCBSP_RX_POLARITY_RISING_EDGE);
//
// Initialize McBSP data length.
//
McBSP_setRxDataSize(MCBSPB_BASE, MCBSP_PHASE_ONE_FRAME,
MCBSP_BITS_PER_WORD_16, 5);
McBSP_setTxDataSize(MCBSPB_BASE, MCBSP_PHASE_ONE_FRAME,
MCBSP_BITS_PER_WORD_16, 5);
//
// Set frame synchronization pulse period to 1 CLKG cycle.
//
McBSP_setFrameSyncPulsePeriod(MCBSPB_BASE, 0);
//
// Set frame-sync pulse width to 1 CLKG cycle.
//
McBSP_setFrameSyncPulseWidthDivider(MCBSPB_BASE, 0);
//
// Set the trigger source for internally generated frame-sync pulse.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



Regards

Varun

  • Varun,

    Yes, the McBSP can handle larger than 32 bit data at a time. The an important thing to note is that the McBSP aslo requires a toggle on the FSX pin between each 32bit word.

    Please go through the table "Bit Values Required to Configure the McBSP as an SPI Slave" verify that you are setting up these bits correctly. I have seen where if just one bit is off, the McBSP can operate in undefined ways even when appearing to work some of the time.

    Link to the TRM: http://www.ti.com/lit/spruhm8

    Please meticulously check your configuration.

    -Mark
  • Varun,

    It has been more than 10 days since you last replied. I am assuming that you have resolved your issue and will close this thread. If you have additional questions, please reply here. If the thread locks (30 days after this post without activity), use the "Ask a related question" button on this page to make a new thread.

    Thanks,
    Mark
  • Hi Mark,
    Sorry I was not able to reply to your message. I asked another question please do have a look at it. And yes, thanks for that info though. I am closing this thread!
    Thanks!