SPI 1-Byte data Write and Read

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

SPI 1-Byte data Write and Read

ソリューションへジャンプ
4,070件の閲覧回数
SadaK
Contributor II

I'm using LPC55S06-EVK. I have downloaded SDK_2_12_0_LPCXpresso55S06.  

As per development kit connection, I'm using the following 4 MCU pins for SPI interface.

  • Pin-59: SCK SPI_FLASH_PIO0_6
    Pin-55: MOSI SPI_FLASH_PIO0_3
    Pin-57: CS SPI_FLASH_PIO0_4
    Pin-54: MISO SPI_FLASH_PIO0_2

I'm using ADXL345 as a SPI slave device.

Question:

Which command to use for 1-byte data Write & Read?

--------------------------------------------------

SPI-Write:

Byte-0 = 0x00 (MOSI, Command/Address. Output from MCU)

Byte-1 = 0x55 (MOSI, Write 1-byte data. Output from MCU)

 

SPI-Read:

Byte-0 = 0x80 (MOSI, Command/Address. Output from MCU)

Byte-1 = 0xXX (MISO, Read 1-byte data. Input to MCU)

 

ADXL345's SPI timing waveform attached

0 件の賞賛
返信
1 解決策
4,019件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello,

I recommend use an example of the SDK from the MCU [spi_interrupt_b2b_transfer_master] then in the library fsl_spi.h you can find some functions to write and read. If you are searching for a command to read and write the part of ADXL it will show it in the datasheet of this part.

Pavel_Hernandez_0-1661281843498.png

In the SDK you will found some examples.

Pavel_Hernandez_1-1661282013471.png

Best regards,
Pavel

 

元の投稿で解決策を見る

4 返答(返信)
4,033件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello,

I review your case, unfortunately, this does not represent an NXP issue, I suggest reviewing the datasheet from the ADXL part, I think it will show you what command is for reading and writing, or in another way contact the vendor.
Then when you have this information you can structure the frame in the example from the LPC.

Best regards,
Pavel

0 件の賞賛
返信
4,026件の閲覧回数
SadaK
Contributor II

Hi,

I have already tested ADXL345 part with STM32 MCU’s using STM32CubeIDE. It works great. As I explained in the initial post. I would like to know how to write & read registers from MCUXpressoIDE using LPC55S06-EVK

I know what data to be written from NXP MCU to access ADXL registers. Those details provided below.

--------------------------------------------------

SPI-Write: 

Byte-0 = 0x00 (MOSI, Command/Address. Output from MCU)

Byte-1 = 0x55 (MOSI, Write 1-byte data. Output from MCU)

 

SPI-Read:

Byte-0 = 0x80 (MOSI, Command/Address. Output from MCU)

Byte-1 = 0xXX (MISO, Read 1-byte data. Input to MCU)

0 件の賞賛
返信
4,020件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello,

I recommend use an example of the SDK from the MCU [spi_interrupt_b2b_transfer_master] then in the library fsl_spi.h you can find some functions to write and read. If you are searching for a command to read and write the part of ADXL it will show it in the datasheet of this part.

Pavel_Hernandez_0-1661281843498.png

In the SDK you will found some examples.

Pavel_Hernandez_1-1661282013471.png

Best regards,
Pavel

 

4,014件の閲覧回数
SadaK
Contributor II

Thanks, this helps..!