SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By drbrodie
#219125
I am trying to run an Adafruit AS7341 breakout with the Artemis Redboard (or Nano) but the "read_all_channels.ino" sketch does not compile (though it does compile on Arduino UNO). Excerpts from the error message are attached. Can you suggest how to resolve this problem?
You do not have the required permissions to view the files attached to this post.
User avatar
By TS-Brandon
#219126
It seems that there could be compatibility issues with the Adafruit_BusIO source files. Since this is an Adafruit library we are unable to provide support. However, I would suggest posting this issue on the Artemis GitHub as an issue ticket. That way our engineers will have visibility of the issue and can work to resolve it as soon as they can.
By stephenf
#219361
I came across this problem and it's easily fixed (I've been using the Adafruit AS7341 library on the Artemis, core 1.2.0 for a while now). If you read the error messages and look in the file (Adafruit_SPIDevice.cpp) that they refer to, they related to SPI stuff, which is not relevant to the AS7341 as it uses I2C. They can be commented out and the errors disappear.

A caveat that this may do bad things if you are using the Adafruit libraries for anything SPI, including in other projects!

Ie. edit the relevant section of your Adafruit_SPIDevice.cpp to look something like this:
Code: Select all
Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin,
                                       int8_t misopin, int8_t mosipin,
                                       uint32_t freq, BitOrder dataOrder,
                                       uint8_t dataMode) {
  _cs = cspin;
  _sck = sckpin;
  _miso = misopin;
  _mosi = mosipin;

#ifdef BUSIO_USE_FAST_PINIO
  // csPort = (BusIO_PortReg *)portOutputRegister(digitalPinToPort(cspin));
  // csPinMask = digitalPinToBitMask(cspin);
  // if (mosipin != -1) {
    // mosiPort = (BusIO_PortReg *)portOutputRegister(digitalPinToPort(mosipin));
    // mosiPinMask = digitalPinToBitMask(mosipin);
  // }
  // if (misopin != -1) {
    // misoPort = (BusIO_PortReg *)portInputRegister(digitalPinToPort(misopin));
    // misoPinMask = digitalPinToBitMask(misopin);
  // }
  // clkPort = (BusIO_PortReg *)portOutputRegister(digitalPinToPort(sckpin));
  // clkPinMask = digitalPinToBitMask(sckpin);
#endif

  _freq = freq;
  _dataOrder = dataOrder;
  _dataMode = dataMode;
  _begun = false;
  _spiSetting = new SPISettings(freq, dataOrder, dataMode);
  _spi = NULL;
}
User avatar
By drbrodie
#219399
Thanks so much for keeping on this. I made the change you suggested and it dd compile but did not run - meaning that the Serial Monitor screen was completely blank. I'm encouraged that you have been using the AS7341 successfully - is there something else I might be missing?
By stephenf
#219400
Debugging is all about baby steps, breaking problems down, and when you get desperate, being very strict about only changing one thing at a time. Also trusting nothing and no-one (and their code) is useful :)

Probably your serial monitor is blank because the baud rate is incorrectly set (and doesn't match the example you compiled). Historical examples often used 9600, whereas newer examples generally use 115200.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum