Artemis Module & BLE

After uploading Experiment8_BLE_LED (Sparkfun 1.0.30) to RedBoard and MicroMod these could be found with BluePixel scanner.

Uploading to Artemis Module this could not be found. Uploading to the Module was OK and also indicated by an added LED blink.

(As MicroMod board was not selectable I ‘cheated’ and choose Module as board for compiling and loading to MicroMod)

Uploading ArduinoBLE…Central…Scan (Sparkfun 2.04) gave same result - found for RedBoard and MicroMod but not for the Module.

What could be the problem ?

Juhan

hi

Help me understand your situation better.

Is the Module running 2.0.x or SDK or 1.0.x library ?

If NOT 2.0.x have you tried to use 2.0.x and the choose one the peripheral examples to load ?

Have you tried to look with nRF connect on your mobile for the module BLE ?

If on 2.0.x can you turn on BLE.debug(Serial) in setup and see what messages you get ?

Paul,

thanks for taking the time to look into my problem with the Artemis Module not being detected by scanners.

Arduino IDE 1.8.9, Windows 7, Sparkfun 1.0.30

Artemis Module, Example8_BLE_LED

After compiling and uploading this is what I can see:

Artemis SVL Bootloader

Got SVL Bootloader Version: 3

[##################################################]Upload complete

From Serial Monitor:

Apollo3 Arduino BLE Example. Compiled: 15:06:11

fm: NusHandlerInit, file: …\AppData\Local\Temp\arduino_build_614732\sketch\nus_main.c, line: 1046

fm: NusStart, file: …\AppData\Local\Temp\arduino_build_614732\sketch\nus_main.c, line: 1130

fm: tagAttCback, file: …\AppData\Local\Temp\arduino_build_614732\sketch\nus_main.c, line: 384

fm: NusHandler, file: …\AppData\Local\Temp\arduino_build_614732\sketch\nus_main.c, line: 1090

fm: tagProcMsg, file: …\AppData\Local\Temp\arduino_build_614732\sketch\nus_main.c, line: 912

pMsg->hdr.event: 0x0052

Not found with BLE Scanners rNF Connect , BluePixel or Pally on an iPAD.

Uploading to Artemis MicroMOD or RedBoard these can be found by the scanners.


With Sparkfun 2.0.4 and Examples/Not Compatible/ArduinoBLE/Periferal/LED these are the responses I got

arm-none-eabi-g++: error: …\apollo3\2.0.4\variants\SFE_ARTEMIS_MODULE/mbed/.cxx-flags: No such file or directory

arm-none-eabi-g++: error: …\apollo3\2.0.4\variants\SFE_ARTEMIS_MODULE/mbed/.includes: No such file or directory

exit status 1

Error compiling for board Artemis Module.

I renamed the file SFE_ARTEMIS to SFE_ARTEMIS_MODULE and compilation was OK.

Artemis SVL Bootloader

Got SVL Bootloader Version: 3

[##################################################]Upload complete

From Serial Monitor:

starting BLE failed!

Uploading to Artemis MicroMOD or RedBoard these can be found by the scanners.

Regards

Juhan

looking at 2.0.4, the starting of the BLE failing is very basic low end.

In the libraries directory of ArduinoBLE, in the local folder, find BLElocalDevice.cpp. Here is where begin() is around line 42.

Rename int BLELocalDevice::begin() to int BLELocalDevice::begin_org().

Now copy passed from below a begin() that shows where it fails…

int BLELocalDevice::begin()
{

// REMOVED PIN SETTINGS NOT RELEVANT FOR APOLLO3
Serial.print("Before HCI.begin\n");
  if (!HCI.begin()) {
    end();
    return 0;
  }

  delay(1000);  // increased paulvha
Serial.print("Before HCI.reset\n");
  if (HCI.reset() != 0) {
    end();

    return 0;
  }

    delay(1000);  // added paulvha
Serial.print("Before READLOCALVERSION\n");
  uint8_t hciVer;
  uint16_t hciRev;
  uint8_t lmpVer;
  uint16_t manufacturer;
  uint16_t lmpSubVer;

  if (HCI.readLocalVersion(hciVer, hciRev, lmpVer, manufacturer, lmpSubVer) != 0) {
    end();
    return 0;
  }
Serial.print("Before setEventMask\n");
  if (HCI.setEventMask(0x3FFFFFFFFFFFFFFF) != 0) {
    end();
    return 0;
  }

  uint16_t pktLen;
  uint8_t maxPkt;
Serial.print("Before readLeBufferSize\n");
  if (HCI.readLeBufferSize(pktLen, maxPkt) != 0) {
    end();
    return 0;
  }
Serial.print("Before GATT BEGIN\n");
  GATT.begin();
Serial.print("DONE\n");
  return 1;
}

Save the file and recompile/ rerun on Artemis to see where it fails.

Paul,

Renameing was not take well by the compiler but without that change I got the following from the module after upload:

Before HCI.begin

Before HCI.reset

starting BLE failed!

This is from compiling :

…\BLELocalDevice.cpp:42:5: error: no declaration matches ‘int BLELocalDevice::begin_org()’

int BLELocalDevice::begin_org()

^~~~~~~~~~~~~~

BLELocalDevice.cpp:42:5: note: no functions named ‘int BLELocalDevice::begin_org()’

In file included from …\ArduinoBLE\src\local\BLELocalDevice.cpp:26:

…\ArduinoBLE\src\local\BLELocalDevice.h:26:7: note: ‘class BLELocalDevice’ defined here

class BLELocalDevice {

^~~~~~~~~~~~~~

exit status

Error compiling for board Artemis Module.

Thanks again !

Juhan

I should have known about the begin_org () error. Sorry for that ! HCI.reset() is the first real command where return value is checked when sent to the HCI physical layer on the Apollo3 chip. NO BLE communication is happening, just local communication between the Apollo3 chip and ArduinoBLE. Maybe your Artemis module is in error. I can try to look to make a debug version to show more detail tomorrow ( evening my time).

Thanks a lot Paul !

I appreciate your help but will be away tomorow so take your time and only if you find it interesting.

I have tested with two different modules but my soldering iron might have a bit hot.

Juhan

I took couple hours to study schematics and code to find reasons why your 2 different modules would not work. But I have not really found anything that could cause it.

The only one aspect I noticed is that the Artemis Module has an 32 Khz Xtal, which is only used for BLE AND only if enabled. The other Artemis modules (like on OpenLog, ATP or Micromod) have a 32.782Khz Xtal, but that is used with the main clock. (mainly calibration) These Xtal’s are also connected to different pins. The BLE code is expecting sourcing from the HFRC, internal MCU clock and NOT the external 32KHz. I have not found a place in the code where it will set for 32KHZ external (e.g. based on Artemis Module) Seems another person already wondered why the 32 Xtal is there : viewtopic.php?f=170&t=54804&p=222850&hi … le#p222850. I don’t think it is used.

Couple of things to try :

Depending on the chip version, some additional BLE registers are set. In attached Ino you can check yours as well as compare to my output in the top of the sketch. Try that and see whether it compares.

Select an RedBoard ATP instead of Artemis Module, compile and load that to the Artemis Module (the pins will not match… but maybe BLE will at least work) Not expecting much from this … but you never know…

In arduinoBLE/src/local/BLELocalDevice.cpp in begin(), around line 89 comment out the reset check:

// if (HCI.reset() != 0) {

// end();

//

// return 0;

// }

In ArduinoBLE/src/utility/HCICordioTransport.cpp begin () around line 207 comment out :

//CordioHCIHook::getDriver().start_reset_sequence();

In ArduinoBLE/src/utility/HCICordioTransport.cpp in bleloop() (around line 114):

set a Serial.print(“BLELOOP\n”); in the top just to be sure it is called.

In ArduinoBLE/src/utility/HCICordioTransport.cpp in bleloop() ):

set a Serial.print(“checking WSF\n”); just before wsfOsDispatcher();(line 144) it will be called many times, but just to make sure it is called (remove it once you know)

Else I am out of thoughts for the moment… maybe a heating issue, maybe you can return the boards. If not… a last wild idea… remove the 30Khz Xtal and see what happens…

test_sketch_feb07a.zip (1.27 KB)

Many thanks for your efforts Paul.

I received some alternative BLE modules today and will leave Artemis for the time being and

test your suggestions later.

I have learned a lot from your input so Thanks a lot !

Juhan

Paul,

Made a last check to test versions with your script and got this

(used Module but compiled as ATP board)

Check revisions

Apollo3_B0 : 0

Apollo3_A1 : 1

Apollo3_A0 : 0

APOLLO3_GE_B0 : 0

APOLLO3_GE_A1 : 1

Before HCI.begin

Before HCI.reset

Before READLOCALVERSION

HCI COMMAND TX → 01011000

Error: Can not initialize BLE

Hard Fault after I call BLE.begin().

Artemis RTC

U8 OK

BME280 OK

RTC set to 2021-3-6

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:

R0: 10007868

R1: 0

R2: 0

R3: 1775230

R4: 0

R5: 10007844

R6: 32A40

R7: 1

R8: 800000B

R9: 0

R10: 0

R11: 0

R12: 2B4C1

SP : 10007730

LR : 2D67F

PC : 2D69A

xPSR : 21000000

PSP : 100076C8

MSP : 1005FF70

CPUID: 410FC241

HFSR : 40000000

MMFSR: 82

BFSR : 0

UFSR : 0

DFSR : 0

AFSR : 0

MMFAR: 32A40

Mode : Thread

Priv : Privileged

Stack: PSP

– MbedOS Fault Handler –

++ MbedOS Error Info ++

Error Status: 0x80FF013D Code: 317 Module: 255

Error Message: Fault exception

Location: 0x2D69A

Error Value: 0x100067A0

Current Thread: main Id: 0x10004B90 Entry: 0x2A415 StackSize: 0x1000 StackMem: 0x10006800 SP: 0x10007730

For more info, visit: https://mbed.com/s/error?error=0x80FF01 … FE_ARTEMIS

– MbedOS Error Info –

Refering to the above mbed problem by rsbohn

After updating to a new Windows 10 computer and installing IDE 8.13, Sparkfun 2.05 and ArduinoBLE 1.2.0 I also got the ‘same’ error Code: 317 Module: 255.

I did not se this with 8.09 , 1.0.30 and 2.04.

Uploading was OK but opening Serial monitor I found the mbed message.

Reverting back to 1.0.30 this Mbed message went away. In no case was BLE working.

Anyone who has been able to get BLE to work with the Artemis Module ?

Juhan

For sure the 1.20 version of ArduinoBLE is not working currently on Artemis. https://github.com/sparkfun/Arduino_Apollo3/issues/362. revert back to 1.1.3. BUT I have no Artemis module and would not know whether it works or not, although we tried before Juhan

I think I have a similar problem with BLE module a couple of months back and this (viewtopic.php?f=169&t=54311) solved the problem. I don’t know if it is related but it doesn’t hurt to try.

Thanks for the tip rodri_e but unfortunately it did not help - neither on my old installation or the new freshly installed pc .

But good to know that the module at least has worked for someone.

Juhan

Has anyone solved this problem? I’m having the same BLE connectivity issues. Thanks!