You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I understand, the STSELib middleware allows managing multiple STSAFE devices at the same time through the bus_id parameter. For example, stse_platform_i2c_send_start() takes the integer bus_id as its first parameter, which can be used by the porting layer to determine which STSAFE device to communicate with (in case multiple STSAFE chips are present).
The issue is that the function stse_platform_Crc16_Accumulate() does not take the bus_id parameter, making this function unsafe for this use case, since it requires saving the CRC calculation state in a static variable, which would end up being corrupted.
Hello, indeed it seems dangerous. Next release will make CRC accumulate re-entrant and safe for multi-device use. But since it's going to be a breaking change, it might not be available so soon. One example to solve it temporarily on your side could be this, only for software implementation :
There will also be few signatures to change accordingly to the new calculate/accumulate functions, include the crc.h in stse_platform.h (for crc structure). But I think compiler should help you figure out where are the small modifications to make. I unfortunately didn't test if this actually solves our problem but on paper it should I think ! Let me know if you have any more troubles !
We do not intend to use multiple STSAFE devices simultaneously, but when I reviewed the CRC porting functions these doubts came to mind, and I was wondering whether I had misunderstood the meaning of the bus_id parameter or if there was an issue with the CRC API.
Your reply clarified that I had interpreted the meaning of the bus_id parameter correctly.
Just to clarify, bus_id is more about peripheral, in case we have multiple I2C buses.
Next release will include some changes only at platform layer. It will include a context at platform layer (one above the current driver context) here but the context will not be at the STSELib layer (in stse_frame.c). So I'm still not expecting it to be fully bullet proof for multi device use or in some specific RTOS configuration.
Activity
nils-cercariolo-st commentedon Feb 10, 2026
Hello, indeed it seems dangerous. Next release will make CRC accumulate re-entrant and safe for multi-device use. But since it's going to be a breaking change, it might not be available so soon. One example to solve it temporarily on your side could be this, only for software implementation :
crc.h:crc.c:stse_frame.c:There will also be few signatures to change accordingly to the new calculate/accumulate functions, include the crc.h in stse_platform.h (for crc structure). But I think compiler should help you figure out where are the small modifications to make. I unfortunately didn't test if this actually solves our problem but on paper it should I think ! Let me know if you have any more troubles !
parmi93 commentedon Feb 10, 2026
We do not intend to use multiple STSAFE devices simultaneously, but when I reviewed the CRC porting functions these doubts came to mind, and I was wondering whether I had misunderstood the meaning of the bus_id parameter or if there was an issue with the CRC API.
Your reply clarified that I had interpreted the meaning of the bus_id parameter correctly.
nils-cercariolo-st commentedon Apr 7, 2026
Just to clarify, bus_id is more about peripheral, in case we have multiple I2C buses.
Next release will include some changes only at platform layer. It will include a context at platform layer (one above the current driver context) here but the context will not be at the STSELib layer (in stse_frame.c). So I'm still not expecting it to be fully bullet proof for multi device use or in some specific RTOS configuration.
fix(crc): Make the PAL layer multi-context-safe
fix(crc): Make the PAL layer multi-context-safe
fix(crc): Make the PAL layer multi-context-safe
fix(crc): Make the PAL layer multi-context-safe
fix(crc): Make the PAL layer multi-context-safe
[fix][crc]: Make the PAL layer multi-context-safe
fix(crc): Make the PAL layer multi-context-safe