Ardupilot dataflash init error

I seem to have a problem with the dataflash on my ardupilot mega board. The firmware upload works fine, but it has some problems when trying to connect to the terminal or MAVlink, I receive a dataflash/compass init error. Could you offer any advice as to how to solve this? I have attached a screenshot of the problem

The exact error I receive is

No Dataflash Inserted, Compass init error

Please try reformatting the dataflash chip, since sometimes if the dataflash chip has not been reformatted, this can cause problems during initialization.

To erase the logs,

  1. please open the terminal tab and go to “logs”,
  2. and then “erase”.

This can take up to 10 minutes.

You will only need to do this once. If the problem persists after the dataflash has been reformatted, there may be a hardware problem, in which case you should contact the shop you purchased it from for further information.