Connect Metaware C Pro to NRF51-DK dev board to reprogram bootloader and flash
I
know that you do not support firmware development but you do give instructions
on how to flash your own firmware to the board. My problem is that I am trying
to flash a c pro using the NRF51 DK as recommended on your site (https://mbientlab.com/firmware/). The
description of the connections for this combination of boards is vague.
I
have (some are guesses as not detailed in guide on website)
C pro
pin 5 Vgnd <-> dk gnd pin
C pro
pin 6 V3v <-> dk P20 pin 1
C pro
pin 11 V3v <-> dk p20 pin 3
C pro
pin 12 Vgnd <-> dk p20 pin 8
C pro
pin 13 SWDIO/nReset <-> dk p20 pin 4
C pro
pin 14 SWDCLK <-> dk p20 pin 5
This
is obviously incorrect. The nrf51 dk board knows that there is an external
board present but cannot connect to it and I have tried a large variety of
tools and combinations to connect.
Comments
I'm trying to work with BMI160 over SPI ( RG board ).
On nrf_drv_config.h:
/* SPI */
#define SPI0_ENABLED 1
#if (SPI0_ENABLED == 1)
#define SPI0_USE_EASY_DMA 0
#define SPI0_CONFIG_SCK_PIN 0
#define SPI0_CONFIG_MOSI_PIN 7
#define SPI0_CONFIG_MISO_PIN 11
#define SPI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
#define SPI0_INSTANCE_INDEX 0
#endif
On main.c:
void spi_event_handler(nrf_drv_spi_evt_t const * p_event)
{
spi_xfer_done = true;
}
void spi_master_init(void)
{
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG(SPI_INSTANCE);
spi_config.ss_pin = SPI_CS_PIN;
spi_config.miso_pin = SPI0_CONFIG_MISO_PIN;
spi_config.mosi_pin = SPI0_CONFIG_MOSI_PIN;
spi_config.sck_pin = SPI0_CONFIG_SCK_PIN;
spi_config.frequency = NRF_DRV_SPI_FREQ_1M;
spi_config.mode = NRF_DRV_SPI_MODE_3;
spi_config.irq_priority = SPI0_CONFIG_IRQ_PRIORITY;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler));
}
On main routine:
m_tx_buf[0] = 0x00 | 0x80 ; // chip id reg adr | read_mask
memset(m_rx_buf, 0, SPI_BUFFER_SIZE);
spi_xfer_done = false;
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, 1, m_rx_buf, 1));
while(spi_xfer_done == false){;}
After the while loop for spi_xfer_done m_rx_buf[0] is always 0xFF;
The main problem is that I can't use oscilloscope ( no test/pad pin on specifications ).
So, I can't understand what happen (debugging step by step seems good).
I tried to swap MISO and MOSI pin cause pdf spacifications is not so clear.
Other strange thing is that in specification pdf there is a draw with i2c BMI160 connection ( Figure 1 Block diagram ) but the "Internal Module Pin list" says that BMI160 is connected via SPI.
Thank you for any answer.
So, I was using in wrong way the function nrf_drv_spi_transfer. The lengh of buffers was 1, not enought for 16bit clock cycle.
Jhurley had the solution and I didn't see: "I was not reading back enough bytes".
Thank you for reading.
Assuming they are correctly defined in your code, what does your bmi160 init code look like? Also, what exactly have you tried thus far?