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.

RM44L920: SPI initialisation not working after flashing

Part Number: RM44L920

I am SPI communication for Accelerometer while i debug the program its calibrating but when flash the program and resetting the power the SPI is not initialising , i am sending data over CAN and observing using esp32 CAN,accelerometer data is not calibrating.So my question is that what happens when we debug the program v flashing the program and how it affects the SPI initialistation.

  • Hi Karthik,

    Make sure the following things! 

    1. CAN communication should work without any issue, If possible instead of CAN communication try to test with UART port.

    2. While reading data make sure you are polling the RXINTFLG flag 

    If we didn't wait till RXINTFLG to read data then in debug it might work due to breakpoints but when we flash it will not work.

    Like as highlighted in below function

    If still issue exists, please share your screen to verify at my end once.

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    we have found the issue when flshing and debugging SPI works but when we do power rest then the accelerometer does not calibrates.Do we need to give some global delays for the initialisation for SPI?

  • Hi Karthik,

    we have found the issue when flshing and debugging SPI works but when we do power rest then the accelerometer does not calibrates.Do we need to give some global delays for the initialisation for SPI?

    If i understand correctly, SPI working when you are flashing the code or debugging but it is not working after we did power RESET.

    If this is the case, then delay before the initialization might not help because when we do first time flashing or debug is also resetting the device before programming the controller. It might be some other issue in my point of view like we might not communicating properly with the accelerometer.

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Can you explain what is happening when we do flash and Debugging which differs from powering on and off the board ?

  • Can you explain what is happening when we do flash and Debugging which differs from powering on and off the board ?

    I don't think there would be much difference because, after flashing or debugging the code the controller will get reset and execute code from the "_c_int00". And same thing will happen when we do power OFF and ON the board.

    I don't think there would be a behavior change for flashing or debugging and power OFF and ON the board.

    --

    Thansk & regards,
    Jagadish.

  • HI Jagadish,

    I understand that there should not be any change in the behaviour, whether we debug it or it is a power reset, but this is what we found from our testing. Currently, we are having to debug/flash the controller every time we want to run any tests, for the accelerometer to send true data. On power reset, we are receiving a constant value from the accelerometer. Please note that rest of the code works as intended on power resets as well and this is the only sensor that is giving us trouble.

    Is there anything that we are missing?

  • Hi Karthik,

    In debug mode are you setting any breakpoints at anywhere to work it or you are running it freely?

    Can you please share your code? Is that possible?

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    No , I am not setting any breakpoints on my Code.

  • Can you please share your code? Is that possible?

  • Hi Jagadish,

    Sorry its not possible to share my code.

  • Is it even not possible for you to create a minimal project with SPI issue you are mentioning?

    How you are executing debug mode, are you running line by line or you just running in continuous debugging?

  • Hi jagadish,

    I am running in continuous debugging mode only.and its not possible to make minimal project code with SPI issue.

  • Hi Karthik,

    Sorry its not possible to share my code.

    In that case can you do one thing,

    If you have a logic analyzer then try to verify the CLK, MOSI, MISO and CS. 

    Verify whether you are seeing any difference in these waveforms with debugging and flashing & reset? So that you can find out what is the difference you are seeing in the communication.

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Yes , now i am working with logic analyser to observe the SPI function, and i could see that after Power rest the accelerometer data's are constant value and while i flash the accelerometer values seems to be changing , as per the accelerometer data sheet guidance i implemented some delays before accelerometer initialisation and calibration but still the the data seems to be same.

  • Hi Karthik,

    now i am working with logic analyser to observe the SPI function,

    Try to compare the working waveforms and not working waveforms.

    and i could see that after Power rest the accelerometer data's are constant value and while i flash the accelerometer values seems to be changing

    I was confused, on start of the thread you mentioned accelerometer is working while doing debug and not working after flashing and reset.

    Now you are saying while doing flash it is working and Power rest not wokring?

    --

    Thanks & regards,
    Jagadish.