Cannot read value using GPMEM over IPC on nrf7002DK

Hello,

I made a firmware that uses the IPC from the net core to the app core on the nrf700DK board.

I can read the events that generate callback on the receiver core (app core). I want to pass a value from the net to the app core using GPMEM.

I have attached the code:

net core:

int main(void)
{
	#if defined(__ZEPHYR__)
    IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_TIMER_INST_GET(TIMER_INST_IDX)), IRQ_PRIO_LOWEST, NRFX_TIMER_INST_HANDLER_GET(TIMER_INST_IDX), 0, 0);
	IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIS_INST_GET(SPIS_INST_IDX)), IRQ_PRIO_LOWEST,NRFX_SPIS_INST_HANDLER_GET(SPIS_INST_IDX), 0, 0);
	//IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_IPC_CHANNEL_0),IRQ_PRIO_LOWEST,ipc_event_handler,0,0);
	IRQ_CONNECT(IPC_IRQn, 1, nrfx_ipc_irq_handler, 0, 0);
	#endif
	nrfx_err_t err;

	init_hfclk();
	init_gpio();
	init_timer();
	init_spis();

	err = nrfx_ipc_init(1, (nrfx_ipc_handler_t)ipc_event_handler, NULL);
	nrfx_ipc_send_task_channel_assign(IPC_EVENT_ID_0, IPC_CHANNEL_ID_0);
	
	while(1)
	{
		if(flag)
		{
			nrfx_ipc_gpmem_set(0,mem);
			mem_value = NRF_IPC->GPMEM[0];
			nrf_gpio_pin_toggle(LED);
			flag = false;
		}
		
	}
	return 0;
}

static void spis_handler(nrfx_spis_evt_t const * p_event, void * p_context)
{
    if (p_event->evt_type == NRFX_SPIS_XFER_DONE)
    {
		switch (cmd_spi_rx_buf_slave[0])
		{
			case 0xE1:
				nrfx_ipc_signal(IPC_EVENT_ID_0); 
				flag = true;
			break;

		default:
			break;
		}
		nrfx_spis_buffers_set(&spis_inst, NULL, 0, cmd_spi_rx_buf_slave, sizeof(cmd_spi_rx_buf_slave));
    }
}

Using the debug I can see that the mem_value is equal to the value set using nrfx_ipc_gpmem_set() 

app core:

int main(void)
{
	#if defined(__ZEPHYR__)
	IRQ_CONNECT(IPC_IRQn, 1, nrfx_ipc_irq_handler, 0, 0);
	#endif

	nrfx_err_t err;

	init_gpio();

	err = nrfx_ipc_init(1, (nrfx_ipc_handler_t)ipc_event_handler, NULL);
	nrfx_ipc_receive_event_channel_assign(IPC_EVENT_ID_0, IPC_CHANNEL_ID_0);
	nrfx_ipc_receive_event_enable(IPC_EVENT_ID_0);

	while(1)
	{
		if(ipc_rcv)
		{
			data = nrfx_ipc_gpmem_get(0);
			if(data == 0xE1)
			{
				nrf_gpio_pin_toggle(LED);
			}
			ipc_rcv = false;
		}
	}

	return 0;
}

void ipc_event_handler(uint32_t event_mask, void * p_context)
{
	if(event_mask == IPC_EVENT_ID_0)
	{
		ipc_rcv = true;
	}
}

Using the debugger in the net core I see the value of GPMEM[0] equal to 0
The proj.conf file are:
net core:
CONFIG_GPIO=y
CONFIG_NRFX_TIMER0=y
CONFIG_LOG=n
CONFIG_SERIAL=n
CONFIG_NRFX_SPIS0=y
CONFIG_NRFX_IPC=y


CONFIG_MAIN_STACK_SIZE=4096
app core:
CONFIG_GPIO=y
#CONFIG_IPC_SERVICE=y
CONFIG_BOARD_ENABLE_CPUNET=y
CONFIG_NRFX_IPC=y

How can I pass data between cores?
Thanks
Parents
  • I appreciate the links you provided but I'm having trouble finding information on how to use nrfx_ipc_gpmem_get(). I don't want to implement an rpm service; I just need to send around 80 bytes of data asynchronously. My plan is to place the data in the GPMEM on one core and read it on the other core.

    Can I achieve this using the functions in the nrfx_ipc.h file?

Reply
  • I appreciate the links you provided but I'm having trouble finding information on how to use nrfx_ipc_gpmem_get(). I don't want to implement an rpm service; I just need to send around 80 bytes of data asynchronously. My plan is to place the data in the GPMEM on one core and read it on the other core.

    Can I achieve this using the functions in the nrfx_ipc.h file?

Children
No Data
Related