Boards Manager for LoRaONE (Beta)

Hi,

For those of you with a LoRaONE, I have a Boards Manager configuration for testing.
It is the pre-release of our v1.6.7 SodaqCore-samd. It has support for SODAQ LoRaONE.

If you want to try it you can set this URL in your preferences.txt

http://downloads.sodaq.net/test/package_sodaq_index.json

Notice the “/test/” part in there.

Remember that it is work in progress

Hi Kees,

I took a quick peek, it seems to have updated files and to provide for the proper pinout of the LoraOne pretty much as I did already myself. It doesn’t provide for the mods I made for Wire.cpp and SERCOM.cpp, but you can do these easily yourself. I will put some instructions together this evening and share these with you.

Here it is – to read bytes available from the uBlox …

// Arduino15/packages/SODAQ/hardware/samd/1.6.6/cores/arduino/SERCOM.cpp                                                                                                                                                                            
// in function  -- bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag)
// Ignore debug statements

484c485,487
< while ( !isBusIdleWIRE() );

// SerialUSB.print("Bus = ");
// SerialUSB.println(sercom->I2CM.STATUS.bit.BUSSTATE,HEX);;
while (!isBusIdleWIRE() && sercom->I2CM.STATUS.bit.BUSSTATE != 2); // WIRE_IDLE_STATE or WIRE_OWNER_STATE Bus idle or ‘we’ are the owner

//  Arduino15/packages/SODAQ/hardware/samd/1.6.6/libraries/Wire/Wire.cpp 
// in function -- uint8_t TwoWire::endTransmission(bool stopBit)
// stopBit has no function, add conditional logic to make it work
130a131,132
> 	if (stopBit)
> 	{
131a134,135
> 	}

Increased the buffer size in Ringbuffer.h (used by Wire.cpp)
#define SERIAL_BUFFER_SIZE 256

Use below to read bytes available ….
  Wire.beginTransmission(0x42);

i = Wire.write((uint8_t)0xfd); // Set register
i = Wire.endTransmission(false); // No stopbit as per manual DDC ublox (i.e. do not release the bus)
i = Wire.requestFrom(0x42, 2);//
uint16_t bytes = Wire.read() << 8;
bytes |= Wire.read();

Use below to read blocks from 128 bytes or more (depending on your serial_buffer size) 
Wire.requestFrom(0x42, 128);

Let me if this makes sense …

Thanks. I’ll have a look

Meanwhile I found some errors in the boards variant. I’ll fix those first.

You should learn how to use GIT :slight_smile:
It would make it a lot easier to discuss code changes.

Please update the Boards Manager for SODAQ SAMD Boards. The update has a few important
fixes for the pin numbers.

Since this is purely development and testing you have to do it as follows:

  1. Delete the file sodaqsamdboards-1.6.7.tar.bz2 from ~/.arduino15/staging/packages/sodaqsamdboards-1.6.7.tar.bz2
  2. In Arduino IDE go to Boards Manager and first choose Remove SODQ SAMD Boards (if version 1.6.7 was installed)
  3. Next in Boards Manager choose to install version 1.6.7 of SODAQ SAMD Boards

Hi Kees, I’m quiet familiar with GIT - Let me know where the sources are I need to pull in order for you to merge back …
BTW What did you change to variant.cpp when I diff I only see textual changes.

Hmm I just looked at https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/SERCOM.cpp and found the issue I found to be corrected already … same applies to https://github.com/arduino/ArduinoCore-samd/blob/master/libraries/Wire/Wire.cpp - well I least I spend a Sunday afernoon learning more about I2C :smile:

Good point!

We have SodaqCore-samd at github, but that won’t have the LoRaONE yet. We have our own GIT server, but that is not publicly accessible. Unless … Can you PM me and I’ll give you access.

BTW. We have cloned ArduinoCore-samd into SodaqCore-samd.

Every now and then I need to merge the Arduino changes into our own core. From your reply I get the impression that we need to do it once more

Yes, it looks like this …

// Wait idle or owner bus mode
while ( !isBusIdleWIRE() && !isBusOwnerWIRE() );

Pretty much the same I did … same for Wire.cpp …

This one, I guess

commit a2949d505f977ab267ce28c4b02ad17a4088a4e1
Author: Sandeep Mistry <s.mistry@arduino.cc>
Date:   Wed Nov 18 09:19:04 2015 -0500

    Wait for idle or bus owner state in startTransmissionWIRE instead of storing repeated start state.

Hi,

I’ve placed an update of v1.6.7 the Boards Manager in

http://downloads.sodaq.net/test/package_sodaq_index.json

To use this update you have follow a few special steps, see below.

In this update

  • included the latest ArduinoCore-samd
  • the size of SERIAL_BUFFER_SIZE is increased to 129

To install:

  1. remove the downloaded tar.bz2 from disk (see below)
  2. in Arduino IDE, go to Boards Manager, select SODAQ SAMD and “Remove”
  3. while still in Boards Manager, select SODAQ SAMD and install 1.6.7

To remove the downloaded tar.bz2 you need to find your arduino15/staging/packages directory.
On Linux it is located at:

~/arduino15/staging/package/sodaqsamdboards-1.6.7.tar.bz2

On MacOS it is

~/Library/Arduino15/staging/package/sodaqsamdboards-1.6.7.tar.bz2

On Windows it might be at

C:\Users\(username)\AppData\Local\Arduino15/staging/package/sodaqsamdboards-1.6.7.tar.bz2

There is another update of our SodaqCore-samd v1.6.7 in

http://downloads.sodaq.net/test/package_sodaq_index.json

See the notes above about how to take the update.

This time I restarted the SodaqCore-samd based on ArduinoCore-samd v1.6.5. That means there are a lot of changes compared to our v1.6.6. Our own changes will be listed in the CHANGELOG soon, but I’ll add them here.

  • Add ARDUINO_SAMD_VARIANT_COMPLIANCE 10603
  • Added PWM to the RGB pins.
  • Fixed Serial. Description required SERCOM_ALT.
  • Fixed a spelling mistake for SWITCH_SENSE.
  • Correction include guard of sodaq_wdt/variant.h
  • There was a one off in the middle of g_APinDescription
  • Rename board id for LoRaONE in boards.txt
  • Increase SERIAL_BUFFER_SIZE to 129
  • Renamed the openocd_scripts cfg file.
  • Initial attempt at a pin mapping for the LoRaONE
  • Add new board variant for WDT
  • Correct chipname in debug script
  • Add new variants “serial3” and “serial23”
  • Add shell script to generate the distribution tar.bz2
  • Add board variant with Serial2
  • Undo the change in platform.txt for 1.6.6
  • Add pins for SD_DFLASH and CS_SD to match the names on Autonomo rev4
  • Avoid using void* in an arithmetic expression (in USBDeviceClass::send)
  • Changed hardcoded A0 for DAC in analogWrite()
  • Adding initialisation of TC6 & TC7
  • Added the same clock divider rule as the G18
  • Remove USB_HOST_ENABLE, we don’t have the hardware to output USB power
  • Make prototype of Serial_::begin consistent with implementation
  • Add boards.txt, platform.txt and variants

There is another update of our SodaqCore-samd v1.6.7 in

http://downloads.sodaq.net/test/package_sodaq_index.json

See the notes above about how to take the update.

  • Added PWM capability to D8 D9.
  • Add Autonomo sub-variant “… with SPI1”

@keesbakker I would like to have a second I2C bus available of the groove shield, would that be possible ?

For which board? Autonomo or LoRaONE?

On the Autonomo … (LoraOne doesn’t have a grove shiled :slight_smile: )

Have a look at the new Boards Manager, there should now be one called “SODAQ Autonomo with SPI1” which connects to D5…D8.
Not a perfect solution (you need to connect three Groves, I think), but at least the possibility is there.