While writing to internal flash, I'm getting "INTFLASH_KEY_INVALID - Error code: 2354". How do I write to internal flash?
When writing to internal flash, the key is only valid for the duration of a single packet, so the operation to write the key and to write or erase the data must be grouped into a single packet. LJM has multiple value functions, such as LJM_eWriteAddresses, which allow you to write the key while writing other values. To ensure packets are within the allowable packet size, you can read the MaxBytesPerMB
parameter of LJM_GetHandleInfo to get the maximum packet size for the connection type in use. Then, use the Modbus protocol description to figure out how many values you can send. LJM uses Feedback (MBFB).
Also, note that having LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES enabled (as it is by default) will help the efficiency of writing to internal flash.