MOSI stays high after data transfer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MOSI stays high after data transfer

1,659件の閲覧回数
edsonsanchez
Contributor I

Hi,

I am using the k40 and I am trying to communicate with another chip from Linear Technology. I am looking at the SPI signals coming out of the k40 and I notice that the MOSI pin stays high after the data has been sent out. I want it to remain low after data transmission... Does anybody know how to do this?

I am using the MQX SPI example and have modified it to communicate with the LT chip.

Thanks!

0 件の賞賛
返信
1 返信

900件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi, I am not sure why you want such thing, but unfortunately this cannot be solved by any SPI configuration. SOUT signal always return to high logic in idle state.

  1. option: you can invert whole output signal by external inverter (like 74HC14). However I suppose that, you don’t want take care on inverting values on master or slave side.
  2. option: you can switch pin multiplex to GPIO during time when SOUT is inactive.

Best way how to do is create Chip select function which will be called at begin and at end of transfer.

For example (TWR-K40D100M, SPI0, I configured SOUT pin to input with pulldown):

#define BSP_SPI_MEMORY_SPI_CS  1

_mqx_int set_CS (uint32_t cs_mask, void *user_data)

{

    PORT_MemMapPtr  pctl;

    pctl = (PORT_MemMapPtr)PORTD_BASE_PTR;

    pctl->PCR[2] |= PORT_PCR_PE_MASK; /* enable pull-up/down*/

    if (cs_mask & BSP_SPI_MEMORY_SPI_CS)

    {

pctl->PCR[2] = PORT_PCR_MUX(2)|PORT_PCR_PE_MASK;    /* DSPI0.SOUT  */

    }

    else

    {

pctl->PCR[2] = PORT_PCR_MUX(1)|PORT_PCR_PE_MASK;    /* DSPI0.SOUT as GPIO */

    }

    return MQX_OK;

}

Inside task:

spifd = fopen (TEST_CHANNEL, NULL);

callback.CALLBACK = set_CS;

if (SPI_OK == ioctl (spifd, IO_IOCTL_SPI_SET_CS_CALLBACK, &callback))

    {

        printf ("Setting CS callback ...OK\n");

    }

…write to SPI


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信