BCM20737TAG SPI timing

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

scope_0.png

scope_1.png

Above pictures in oscilloscope screenshort of BCM20737TAG SPI, spi_pressure_sensor application.

D3 is CS

D2 is CLK.

D1 is MOSI

D0 is MISO

I have a question that why CLK juse have five rising edge? I think it should be 8-bit transfer.

0 Likes
1 Solution
MiTo_1583836
Level 5
Level 5
50 likes received 25 likes received 10 likes received

Hi Kai.ren,

Are you connected to the actual sensor over SPI? You will need it before running the application. If you look at the top of the .c file you will have:

* SPI Pressure Sensor Sample

*

* This application provides the sample code interfacing the MS5525DSO

* pressure sensor (http://www.meas-spec.com/product/pressure/MS5525DSO.aspx)

* over the SPI interface.  The application initializes the second SPI interface

* to communicate with the sensor to get calibration data then read the pressure

* and temperature which is displayed on the debug UART.  See application note

* http://www.amsys.de/sheets/amsys.de.an520_e.pdf on the calculation details.

The first byte that will be sent is a 0x1E (CMD_RESET) through the pressure_sensor_create() function.

You should have the 8 clock periods during the call spiffyd_txData(SPIFFYD_2, 1 ,&byteToSend). The BLE is working as a master in this scenario and will drive the clock for the sensor (sensor working as slave).

View solution in original post

9 Replies
MiTo_1583836
Level 5
Level 5
50 likes received 25 likes received 10 likes received

Hi Kai.ren,

Are you connected to the actual sensor over SPI? You will need it before running the application. If you look at the top of the .c file you will have:

* SPI Pressure Sensor Sample

*

* This application provides the sample code interfacing the MS5525DSO

* pressure sensor (http://www.meas-spec.com/product/pressure/MS5525DSO.aspx)

* over the SPI interface.  The application initializes the second SPI interface

* to communicate with the sensor to get calibration data then read the pressure

* and temperature which is displayed on the debug UART.  See application note

* http://www.amsys.de/sheets/amsys.de.an520_e.pdf on the calculation details.

The first byte that will be sent is a 0x1E (CMD_RESET) through the pressure_sensor_create() function.

You should have the 8 clock periods during the call spiffyd_txData(SPIFFYD_2, 1 ,&byteToSend). The BLE is working as a master in this scenario and will drive the clock for the sensor (sensor working as slave).

Anonymous
Not applicable

Did the issue get resolved? I'm using the BMC20737 TAG board.  I am using 1,000,000 speed and get 8 clock pulses per byte.  When I try to change the speed to 2,000,000 I started seeing strange effects, for example the clock still had 8 pulses but some of my data pulses did not look correct, for example I sent FF and only saw F0 on the scope.

0 Likes

Hi ehoffman,

Besides the BCM20737 Tag board, what do you have connected on the SPI bus?

Anonymous
Not applicable

With the Tag board as master I'm trying to drive a Texas Instrument ADC (ADS1248) via the SPI interface.  I'm attempting to configure the ADC by sending "Load Register" commands across the SPI interface.  I see the SPI clock and data signals going out from the TAG board but I get no response from the ADC when I try to read back the registers.   i.e. The readback is giving me zero instead of the value I stored in the register.  But that's only half my problem.  The first problem is why does the App hang after the first 7 bytes?

Thanks,

Eric

0 Likes

Let's see if I can help:

I would try first to read bits/bytes that are read-only in register. There is a register called "ID" at the address 0Ah. It should be easy to read it. The definition of the register in the documentation is:


0bID3 0bID2 0bID1 0bID0 0bDRDYMODE 0b0 0b0 0b0

.

There are some hints on what could be the IDx bits here: http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/324251.aspx

Maybe you have a way to know the value from somewhere else.

The command to issue is a SPI "Read Register" as follow: 0010 rrrr (2xh) | 0000_nnnn (with rrrr= 0b1010 (ID register), nnnn = 0b0000).

I would follow it with a SPI read with NOP data (0xFF) in order to get the register value back (see version #2).

The two set of calls I would do in your case:

-- Version #1 (without NOP, just for test, it may work!):

UINT8 byteToSend[2] = {0x2A, 0x00};

UINT8 byteToReceive = 0;

//Select the TI ADC

gpio_setPinOutput(CS_PORT, CS_PIN, CS_ASSERT);

//Send the command, not full duplex, only half duplex.

spiffyd_txData(SPIFFYD_2, 2, (const UINT8*)&byteToSend[0]);

//No explicit NOP sent, let's see what happens

spiffyd_rxData(SPIFFYD_2, 1, (UINT8*)&byteToReceive);

gpio_setPinOutput(CS_PORT, CS_PIN, CS_DEASSERT);

-- Version #2 (with NOP, more accurate):

UINT8 byteToSend[2] = {0x2A, 0x00};

UINT8 byteToSendAnswer = 0xFF;

UINT8 byteToReceive = 0;

//Select the TI ADC

gpio_setPinOutput(CS_PORT, CS_PIN, CS_ASSERT);

//Send the command, not full duplex, only half duplex.

spiffyd_txData(SPIFFYD_2, 2, (const UINT8*)&byteToSend[0]);

//Send the NOP following the spec from TI and get the answer at the same time.

spiffyd_exchangeData(SPIFFYD_2, 1, (const UINT8*)&byteToSendAnswer, &byteToReceive); 

gpio_setPinOutput(CS_PORT, CS_PIN, CS_DEASSERT);

Also for quick sanity check could you please provide the following answers (send me a direct message if you want through the forum):

- Please confirm the parameters that you pass to: spiffyd_configure() ?

- Also what macro do you use to set the variable: spi2PortConfig.spiGpioConfig ?

- Are you disabling pins that are shared with SPI? if yes which one(s)?

Lastly make sure the clock used in spiffyd_configure() is at least at 1MHZ (#define SPEED 1000000). This is the mimnum for the TI chip.

You may have one of the following tools (logic 8): https://www.saleae.com/logic. They are very useful to confirm the behavior of SPI (you can gain hours). I just recommend one of them as "a must" have. You may work with an oscilloscope which is OK too.

Anonymous
Not applicable

after further study, I strongly suspect my problem is a logic level incompatibility between the TAG board and the ADC chip.  The ADS1248 is a CMOS 3.3 volt logic level and I think I need at least 2 volts to get a logic high signal into it.  Unfortunately the TAG is putting out (VDDIO) only 1.8 volts.  Changing the TAG to a higher voltage is an option but it requires replacing some microscopic resistors on the TAG board.   Also I could add level converters between the TAG and the ADC...  I decided to wait until I have a full system to test my ADC driver with.  My PCB's came in with the BCM20736S module and ADS1248 on the same board but now I'm having trouble programming the BCM module... and testing the ADC will have to wait until this problem is solved.  Hoping that will be soon.

0 Likes
Anonymous
Not applicable

I connected a data flash, at45db041, with bcm20737tag, the communication is ok.

Anonymous
Not applicable

kai.ren

Which Of the demo Aps did you use, if any, to test the communocation with the tag? And which Spiffy2 config did you use? (Clk miso mosi config)...

0 Likes
Anonymous
Not applicable

spi_comm_master.

void spiffy2_master_initialize(void)

{

    // Use SPIFFY2 interface as master

    spi2PortConfig.masterOrSlave = MASTER2_CONFIG;

    // pull for MISO for master, MOSI/CLOCK/CS if slave mode

    spi2PortConfig.pinPullConfig = INPUT_PIN_PULL_UP;

    // Use P24 for CLK, P4 for MOSI and P25 for MISO

    spi2PortConfig.spiGpioConfig = MASTER2_P24_CLK_P04_MOSI_P25_MISO;

    // Initialize SPIFFY2 instance

    spiffyd_init(SPIFFYD_2);

    // Define this to the Port/Pin you want to use for CS.

    // Port = P#/16 and PIN = P# % 16

    // Configure the CS pin and deassert it initially.

    // If enabling output, you only need to configure once. Use gpio_setPinOutput to toggle value being o/p

    gpio_configurePin(CS_PORT, CS_PIN, GPIO_OUTPUT_ENABLE | GPIO_INPUT_DISABLE, CS_DEASSERT);

    // Configure the SPIFFY2 HW block

    spiffyd_configure(SPIFFYD_2, SPEED, SPI_MSB_FIRST, SPI_SS_ACTIVE_LOW, SPI_MODE_3);

}