SPI EXAMPLE

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

SPI EXAMPLE

3,600件の閲覧回数
Nadia
Contributor III

HELLO!!
I have problems loading an SPI example, the spi_polling_b2b_transfer_master.c
It always has errors and I don't understand why, I am trying to do something similar with a DAC that works by SPI, I try to send an array of data as it is done in the example, but it doesn't work either.

If someone knows why the example doesn't work correctly, and how to send an array of data from the SPI, please let me know.

Thank you very much.
Best regards.

0 件の賞賛
返信
7 返答(返信)

3,576件の閲覧回数
Nadia
Contributor III

I'm using the MCP4821 DAC, which I don't know if it might be incompatible or something.

0 件の賞賛
返信

3,581件の閲覧回数
frank_m
Senior Contributor III

> If someone knows why the example doesn't work correctly, and how to send an array of data from the SPI, please let me know.

SPI is a loosely defined protocol, with variants in e.g. clock polarity, trigger edge, and clock speed.

Your SPI master setup (MCU) need to match the requirements of the slave (DAC).

As suggested, take a logic analyser or scope and compare the signal form with the DAC datasheet.

And I hope you are aware that SPI is a synchronous protocol, but the slave response is deferred by at least one transfer cycle.

3,556件の閲覧回数
Nadia
Contributor III

@frank_m WHAT FUNCTION SHOULD I USE TO TRANSMIT IN SPI WITHOUT NEEDING A RESPONSE? How can I set the clock to 16 pulses?

0 件の賞賛
返信

3,549件の閲覧回数
frank_m
Senior Contributor III

> WHAT FUNCTION SHOULD I USE TO TRANSMIT IN SPI WITHOUT NEEDING A RESPONSE?

I suppose you mean, without regarding the response.

You can either read it out to clear any interrupt/FIFO flag, and discard the value. Or configure the SPI FIFO to ignore RX data (FIFOWR, bit 22 = RXIGNORE).

The standard SPI interface contains a write (MOSI) and a read (MISO) line, from the master's view. Each clock pulse cycles one bit out on MOSI and one bit in on MISO simultaneously.

> How can I set the clock to 16 pulses?

The same SPI config register (FIFOWR) contains a length field, bits 27..24. A 16-bit transfer corresponds to a value 0xF for this field. 

Check the user manual, SPI section for details. (UM10912, sect. 26.6.14 for the LPX546xx),  I don't know the associated SDK functions, I haven't used them yet.

0 件の賞賛
返信

3,594件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Nadia,

To help you please provide more information:

1) Which chip?

2) Does it have issue when directly run demo?

3) What about the detail issue about doesn't work? 

4) You can use Logic measure signal .

 

BR

Alice

 

0 件の賞賛
返信

3,586件の閲覧回数
Nadia
Contributor III

@Alice_YangLPC54628,When I run the demo with the test board I get the messages that there has been an error, the printf's of the program that say that there has been an error I mean.

 

I am not modifying the demo.

0 件の賞賛
返信

3,573件の閲覧回数
Nadia
Contributor III

I'm using the MCP4821 DAC, I don't know if it might be incompatible.

0 件の賞賛
返信