Hi,
I am Using NRF52840-DK. I merged the UART Example code (PCA10056) into the nRFX_SPIM (PCA10056) example code. That compile successfully I want to print a simple statement using the printf function. but whenever I add the printf statement I get the error as mentioned in the subject. I checked several links regarding this on the forum I was asked to add header file <stdio.h> which I did. In spite of that, the error persists. can you please assist me regarding this.
Please Find Attachment.
Thanks,
Rohit Patil,
int main(void)
{
uint32_t err_code;
MAX30003_begin();
//uint8_t DataPacketHeader[5];
//// data |= (SPI_RX_Buff[1] << 16);
MAX30003_Reg_Read(ECG_FIFO); //0x0F
SPI_RX_Buff[0]= SPI_RX_Buff[0] >> 8;
//uint8_t my_sample_1 = SPI_RX_Buff[0];
//my_sample_1= 0x00;
bsp_board_init(BSP_INIT_LEDS);
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_DEFAULT_BACKENDS_INIT();
const app_uart_comm_params_t comm_params =
{
RX_PIN_NUMBER,
TX_PIN_NUMBER,
RTS_PIN_NUMBER,
CTS_PIN_NUMBER,
UART_HWFC,
false,
#if defined (UART_PRESENT)
NRF_UART_BAUDRATE_115200
#else
NRF_UARTE_BAUDRATE_115200
#endif
};
APP_UART_FIFO_INIT(&comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
uart_error_handle,
APP_IRQ_PRIORITY_LOWEST,
err_code);
APP_ERROR_CHECK(err_code);
#ifndef ENABLE_LOOPBACK_TEST
printf("\r\nUART example started.\r\n");
nrfx_spim_config_t spi_config = NRFX_SPIM_DEFAULT_CONFIG;
spi_config.frequency = SPIM_FREQUENCY_FREQUENCY_K125;
spi_config.ss_pin = NRFX_SPIM_SS_PIN;
spi_config.miso_pin = NRFX_SPIM_MISO_PIN;
spi_config.mosi_pin = NRFX_SPIM_MOSI_PIN;
spi_config.sck_pin = NRFX_SPIM_SCK_PIN;
spi_config.dcx_pin = NRFX_SPIM_DCX_PIN;
spi_config.use_hw_ss = true;
spi_config.ss_active_high = false;
spi_config.mode = NRF_SPIM_MODE_2; // SCK active low, sample on trailing edge of clock
nrfx_spim_xfer_desc_t xfer_desc = NRFX_SPIM_XFER_TRX(SPI_TX_Buff, sizeof(SPI_TX_Buff), SPI_RX_Buff, sizeof(SPI_TX_Buff));
APP_ERROR_CHECK(nrfx_spim_init(&spi, &spi_config, spim_event_handler, NULL));
//memcpy(&my_sample_1,SPI_RX_Buff , (sizeof(uint8_t)));
NRF_LOG_INFO("NRFX SPIM example started.");
while (1)
{
// Reset rx buffer and transfer done flag
memset(SPI_RX_Buff, 0, m_length);
spi_xfer_done = false;
APP_ERROR_CHECK(nrfx_spim_xfer_dcx(&spi, &xfer_desc, 0, 15));
uint8_t cr;
while (app_uart_get(&cr) != NRF_SUCCESS);
while (app_uart_put(cr) != NRF_SUCCESS);
while (!spi_xfer_done)
if (cr == 'q' || cr == 'Q')
{
printf(" \r\nExit!\r\n");
while (true)
{
// Do nothing.
}
}
{
__WFE();
}
NRF_LOG_FLUSH();
bsp_board_led_invert(BSP_BOARD_LED_0);
//nrf_delay_ms(200);
}
#else
while (true)
{
uart_loopback_test();
}
#endif
}