'radio init planting with i2c communication

I'm using a STM32WL55JC in dual core configuration to communicate with LoRa protocol. I'm also working on an OLED display interface using I2C communication on the same MCU.

The OLED interface come from this library that I rework a bit to use it with stm32wl.

I have a working application using LoRa communication without OLED interface. The OLED interface work well also without the LoRa application.

But when I join the two project, the radio init function drive me into ErrorHandler...

After investigating I find some weird things happening...

First, the radio init bug occurred only when I'm calling ssd1306_WriteString. But it doesn't matter what is in this function, in fact if I comment everything in it, its still bugging... So just the fact that I'm calling the function make my program plant... May it come from the parameters of the function?

Secondly, If I call ssd1306_WriteString before the radio init, it print what I want on the screen and when radio init happen ErrorHandler occured. But also, if I'm calling ssd1306_WriteString after radio init, ErrorHandler occured on radio init... How it can be possible? ssd1306_WriteString() was never called and it make radio init bug?

I really can't find any links between all of this... My suggestion is that may come from font parameter of ssd1306_WriteString() function. But what is the link between that and radio? Or maybe the problem is not about radio but about dual core configuration?

----------------------------------------------------- MAIN --------------------------------------------------
int main(void)
{
     // --------------------------
     // ---  Initialization  ---
     // --------------------------
    
     // Hardware configuration
     hardware_config();
    
     ssd1306_Init();
     ssd1306_SetCursor(2, 0);
     ssd1306_WriteString("Font 16x26", Font_16x26, White);
     ssd1306_UpdateScreen();
    
     // Radio Management Initialization
     g_radiocom_mgt.initialization(&g_addressing_protocol, &g_EEPROM_emul_driver);
}

---------------------- RADIO COMMUNICATION INITIALIZATION------------------------------------
void radio_com_mgt_c::initialization(addressing_protocol_c *i_p_addressing_protocol, EEPROM_emul_driver_c *i_EEPROM_emul_driver_c)
{
  // Variable declaration
  RadioEvents_t RadioEvents;  // Radio events function pointer

  // Attributes initialization
  m_p_addressing_protocol = i_p_addressing_protocol;

  // Radio initialization
  RadioEvents.TxDone  = OnTxDone;
  RadioEvents.RxDone  = OnRxDone;

  RadioEvents.TxTimeout = OnTxTimeout;
  RadioEvents.RxTimeout = OnRxTimeout;

  RadioEvents.RxError  = OnRxError;

  Radio.Init(&RadioEvents);

  // Radio Set frequency
  Radio.SetChannel(RF_FREQUENCY + m_frequency_channel * (BANDWIDTH_VALUE + BANDWIDTH_GAP));

  // Radio configuration
  Radio.SetTxConfig(MODEM_LORA, TX_OUTPUT_POWER, 0,
                    LORA_BANDWIDTH,
                    LORA_SPREADING_FACTOR,
                    LORA_CODINGRATE,
                    LORA_PREAMBLE_LENGTH,
                    LORA_FIX_LENGTH_PAYLOAD_ON,
                    true, 0, 0,
                    LORA_IQ_INVERSION_ON,
                    TX_TIMEOUT_VALUE);

  Radio.SetRxConfig(MODEM_LORA,
           LORA_BANDWIDTH,
           LORA_SPREADING_FACTOR,
           LORA_CODINGRATE,
           0,
           LORA_PREAMBLE_LENGTH,
           LORA_SYMBOL_TIMEOUT,
           LORA_FIX_LENGTH_PAYLOAD_ON,
           0, true, 0, 0,
           LORA_IQ_INVERSION_ON,
           true);

  Radio.SetMaxPayloadLength(MODEM_LORA, PAYLOAD_LEN);

  // Reset tx buffer
  memset(m_BufferTx, 0x0, PAYLOAD_LEN);

  // starts reception
  Radio.Rx(RX_NO_TIMEOUT);

  // register task to to be run in while(1) after Radio IT
  UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_Radio_Com_Mgt_Process), UTIL_SEQ_RFU, radio_com_mgt_task);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source