This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2432: Problem with I&M save in Profinet

Part Number: AM2432

Tool/software:

Hi,

I have a problem with saving I&M data in Profinet.
I have declared the callback PN_APP_IOD_cbStoreRemaMem about like this:

uint32_t PN_APP_IOD_cbStoreRemaMem(PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_RemaDataType_t type, const uint32_t instance, const uint32_t memSize, uint8_t *const srcMem)
{

    switch(type) {

    [...]

    case PN_API_IOD_RemaDataIm1:
        DebugP_log("Save remanent memory indicated. Type: IM1, instance: %u\r\n", instance);

        memset((void *) &myParameters.profinetIM1[instance], ' ', sizeof(profinetIM1_t));
        memcpy((void *) &myParameters.profinetIM1[instance], srcMem, memSize);

        SaveParametersToFlash(); //Function to write my parameters in flash
        PN_API_IOD_dataStoreComplete(pnHandle, sizeof(myParameters));

        break;

    case PN_API_IOD_RemaDataIm2:
        DebugP_log("Save remanent memory indicated. Type: IM2, instance: %u\r\n", instance);

        memset((void *) &myParameters.profinetIM2[instance], ' ', sizeof(profinetIM2_t));
        memcpy((void *) &myParameters.profinetIM2[instance], srcMem, memSize);

        SaveParametersToFlash(); //Function to write my parameters in flash
        PN_API_IOD_dataStoreComplete(pnHandle, sizeof(myParameters));

        break;
        
    case PN_API_IOD_RemaDataIm3:
        DebugP_log("Save remanent memory indicated. Type: IM3, instance: %u\r\n", instance);

        memset((void *) &myParameters.profinetIM3[instance], ' ', sizeof(profinetIM3_t));
        memcpy((void *) &myParameters.profinetIM3[instance], srcMem, memSize);

        SaveParametersToFlash(); //Function to write my parameters in flash
        PN_API_IOD_dataStoreComplete(pnHandle, sizeof(myParameters));

        break;

    case PN_API_IOD_RemaDataIm4:
        DebugP_log("Save remanent memory indicated. Type: IM4, instance: %u\r\n", instance);

        memset((void *) &myParameters.profinetIM4[instance], ' ', sizeof(profinetIM4_t));
        memcpy((void *) &myParameters.profinetIM4[instance], srcMem, memSize);

        SaveParametersToFlash(); //Function to write my parameters in flash
        PN_API_IOD_dataStoreComplete(pnHandle, sizeof(myParameters));

        break;
        
    [...]
    
    }

    return PN_API_OK;
}

But if I try to edit the I&M informations (for example, with the Proneta tool), I see from the debug prints that the callback is called and I can correctly save I&M1, but the callback to save I&M2 and I&M3 are not called at all. Then Proneta no longer shows me the I&M information and I need to restart the device to see them. On reboot then I see that only I&M1 was saved in flash, while the other I&Ms are not actually saved in flash.
However, If I try to use the demo, the I&M management works correctly.
What could I be doing wrong?

Thank you,

Best Regards,

Andrea