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
  • Hi

    So, me and you both seems to have misunderstood the GPMEM registers here. 

    As per the product specification:

    "General purpose memory
    The GPMEM registers can be used freely to store information. These registers are accessed like any other of the IPC peripheral's registers. Note that the contents of the GPMEM registers are not shared between the instances of the peripherals. I.e. writing the GPMEM register of one peripheral does not change the value in another."

    As well as the following:

    "An IPC event often does not contain any data itself, it is used to signal other MCUs that something has occurred. Data can be shared through shared memory, for example in the form of a software implemented mailbox, or command/event queues. It is up to software to assign a logical functionality to an IPC channel. For instance, one IPC channel can be used to signal that a command is ready to be executed, and any processor in the system can subscribe to that particular IPC channel and decode/execute the command."

    So, these IPC events don't contain any data in and of themselves, but just signal to the other core that something occurred. Then data can be shared through shared memory.

    Best regards,

    Simon

Reply
  • Hi

    So, me and you both seems to have misunderstood the GPMEM registers here. 

    As per the product specification:

    "General purpose memory
    The GPMEM registers can be used freely to store information. These registers are accessed like any other of the IPC peripheral's registers. Note that the contents of the GPMEM registers are not shared between the instances of the peripherals. I.e. writing the GPMEM register of one peripheral does not change the value in another."

    As well as the following:

    "An IPC event often does not contain any data itself, it is used to signal other MCUs that something has occurred. Data can be shared through shared memory, for example in the form of a software implemented mailbox, or command/event queues. It is up to software to assign a logical functionality to an IPC channel. For instance, one IPC channel can be used to signal that a command is ready to be executed, and any processor in the system can subscribe to that particular IPC channel and decode/execute the command."

    So, these IPC events don't contain any data in and of themselves, but just signal to the other core that something occurred. Then data can be shared through shared memory.

    Best regards,

    Simon

Children
No Data
Related