Code Monkey home page Code Monkey logo

Comments (6)

dpkoch avatar dpkoch commented on June 18, 2024

I've been trying to track down the problem, but I'm kind of stumped. It appears that the breakdown is in the bool writeEEPROM(bool blink) function, in this for loop:

for (unsigned int tries = 3; tries; tries--)
{
  mavlink_log_warning("Tries remaining: %d", tries);
  FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

  FLASH_ErasePage(FLASH_WRITE_ADDR);
  status = FLASH_ErasePage(FLASH_WRITE_ADDR + FLASH_PAGE_SIZE);
  for (unsigned int i = 0; i < sizeof(params_t) && status == FLASH_COMPLETE; i += 4)
    status = FLASH_ProgramWord(FLASH_WRITE_ADDR + i, *(uint32_t *)((char *)&_params + i));
  if (status == FLASH_COMPLETE)
    break;
}
FLASH_Lock();

If the write works, it runs straight through as expected. When it doesn't work though, it goes through all 3 attempts but on the 3rd attempt seems to never exit from the inner for loop. It doesn't freeze, because the autopilot keeps doing everything else, but it's as if it skips executing the rest of the function without actually returning. Very weird. Any thoughts @superjax or @gellings?

from rosflight_firmware.

superjax avatar superjax commented on June 18, 2024

That is really weird. I'll see if I can't work on it this weekend. I've been trying to get the asynchronous stuff working, and been running into issues myself. Perhaps it'll be good to work on something else for a minute.

from rosflight_firmware.

superjax avatar superjax commented on June 18, 2024

Was this solved?

from rosflight_firmware.

dpkoch avatar dpkoch commented on June 18, 2024

Nope. I've been trying to narrow down the commit where the bug was introduced, but haven't been able to yet. There doesn't seem to be a single commit where after that commit the issue always exists. It seems like instead it might happen in one commit, but not the next, but then comes back again a couple of commits later. So I haven't had any luck tracking it down yet, unfortunately

from rosflight_firmware.

dpkoch avatar dpkoch commented on June 18, 2024

One thing to try might be disabling all interrupts before we try to access the memory? Don't know if this would solve it, but it's possible that entering an interrupt routine messes with the EEPROM access somehow. It may also explain why it used to work then stopped, since we didn't use interrupts before then started using the IMU interrupt. Maybe? Just an ideal I had; I'll try it out as soon as I get a chance.

from rosflight_firmware.

superjax avatar superjax commented on June 18, 2024

This is fixed as of commit 2c879f8

from rosflight_firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.