Coder Social home page Coder Social logo

arduinocore-samd's Introduction

Arduino Core for SAMD21 CPU

This repository contains the source code and configuration files of the Arduino Core for Atmel's SAMD21 processor (used on the Arduino/Genuino Zero, MKR1000 and MKRZero boards).

Installation on Arduino IDE

This core is available as a package in the Arduino IDE cores manager. Just open the "Boards Manager" and install the package called:

"Arduino SAMD Boards (32-bit ARM Cortex-M0+)"

Support

There is a dedicated section of the Arduino Forum for general discussion and project assistance:

http://forum.arduino.cc/index.php?board=98.0

Bugs or Issues

If you find a bug you can submit an issue here on github:

https://github.com/arduino/ArduinoCore-samd/issues

Before posting a new issue, please check if the same problem has been already reported by someone else to avoid duplicates.

Contributions

Contributions are always welcome. The preferred way to receive code contribution is by submitting a Pull Request on github.

Developing

  1. Clone the ArduinoCore-API repo to any convenient location:
    git clone https://github.com/arduino/ArduinoCore-API.git
    
  2. Create an <SKETCHBOOK>/hardware/arduino-git folder, where <SKETCHBOOK> is the location of your Arduino sketchbook.
  3. Change directories:
    cd <SKETCHBOOK>/hardware/arduino-git
    
  4. Clone this repo:
    git clone https://github.com/arduino/ArduinoCore-samd.git samd
    
  5. Change directories:
    cd samd/cores/arduino
    
  6. Copy or symlink the api folder from the ArduinoCore-API repo:
    ln -s <ARDUINO_CORE_API>/api .
    
    where <ARDUINO_CORE_API> is the location where you've cloned the ArduinoCore-API repository to.
  7. Restart the IDE.

Hourly builds

This repository is under a Continuous Integration system that every hour checks if there are updates and builds a release for testing (the so called "Hourly builds").

The hourly builds are available through Boards Manager. If you want to install them:

  1. Open the Preferences of the Arduino IDE.
  2. Add this URL http://downloads.arduino.cc/Hourly/samd/package_samd-hourly-build_index.json in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Hourly build
  5. Select one of the boards under SAMD Hourly build XX in Tools->Board menu
  6. Compile/Upload as usual

If you already installed an hourly build and you want to update it with the latest:

  1. Open the Boards Manager (menu Tools->Board->Board Manager...)
  2. Remove Arduino SAMD core - Hourly build
  3. Install again Arduino SAMD core - Hourly build, the Board Manager will download the latest build replacing the old one.

License and credits

This core has been developed by Arduino LLC in collaboration with Atmel.

  Copyright (c) 2015 Arduino LLC.  All right reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

arduinocore-samd's People

Contributors

adminius avatar aentinger avatar aethaniel avatar agdl avatar bbx10 avatar cmaglie avatar facchinm avatar fede85 avatar giulcioffi avatar helmut64 avatar jandrassy avatar jcbuda avatar jhansson-ard avatar jnthbdn avatar joverbee avatar jrowberg avatar ksmith3036 avatar ladyada avatar mastrolinux avatar matthijskooijman avatar nmaas87 avatar paolop74 avatar per1234 avatar polygamma avatar rocketct avatar rocketscream avatar sameer avatar sandeepmistry avatar silvanocerza avatar tomkeddie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinocore-samd's Issues

analog and serial issue

  1. no analog output on 7
  2. program keep go into serial error irq if serial connect to nothing,
    the function clearStatusUART seems not working

burning the SAM-BA bootloader with an external programmer (e.g. Atmel-ICE) [Zero]

burning the SAM-BA bootloader out of the IDE works fine when using the EDBG-chip
(choosing "Arduino Zero (Programming Port)" as the board)

but it does not work when using a external programmer like Atmel-ICE (choosing "Arduino Zero (Native USB Port)" as the board)

by adding this two lines to the file:
C:\Users\USERNAME\AppData\Roaming\Arduino15\packages\arduino\hardware\samd\1.6.0\boards.txt
(at the end of the part for the "Arduino Zero (Native USB Port)")
the problem is gone
(see --> http://forum.arduino.cc/index.php?topic=330699.0 )


arduino_zero_native.bootloader.tool=openocd
arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin

SERCOM + yield() ?

I can't be sure without more testing but it seems SERCOM blocks indefinitely when I2C is expected but not present; under these circumstances a yield() statement in the while loops and also a timeout seems desirable.

Next release date?

Hello. I was wondering if there is an expected date for the next release of the SamD core? The last one was in July, so it's been quite a while. I'm getting ready to ship my product and it would help a lot to have a new release that includes the fixes which have gone in since July.

Any info you can provide on the release schedule would help a lot. Thanks!

Bootloader as Atmel Studio Project

Please add the bootloader as an Atmel Studio Project format, and/or improve the documentation on how use/build/modify/upload the bootloader.

the pin mode is changed to INPUT mode

on file wiring.c line 87(Fun init()) Setup all pins (digital and analog) in INPUT mode (default is nothing)
Pin mode should not be set.This line should comment.

on file wiring_digital.c line 81 (Fun digitalWrite()) Enable pull-up resistor.
This line should comment.

The pin mode will be initialized when construct the object.

For example:

class LED
{
  public:
    LED(int pin);
    void low();
    void high();
  private:
    int led_pin;
};

LED::LED(int pin)
{
  led_pin = pin;
  pinMode(led_pin, OUTPUT) ;
}

void LED::low()
{
  digitalWrite(led_pin, LOW);
}
void LED::high()
{
  digitalWrite(led_pin, HIGH);
}

LED led(13);
void setup() {
}

void loop() {
  led.high();
  delay(1000);
  led.low();
  delay(1000);
}

Since the pin mode is changed to INPUT,led.high() is set to input pull-up and led.low() is set to input pull-down.So the led will be very dark.

Turn off USB functionnality / SerialUSB.end() not implemented

SerialUSB.end() function in cores/arduino/USB/CDC.cpp is not implemented.

When trying to jump from an application to an other (using this function http://pastebin.com/FyjkXJR2), the new application doesn't start if the USB cable is plugged in. I tried to do a SerialUSB.end() rigth before jumpApplication(), but the function is not implemented. I think something should be done to be able to stop all USB activity. Maybe it is not the aim of this function. If so, please point me to the right one 😃

Thanks!

Press the reset button does not start bootloader

If the user's program was wrong, the board can not start bootloader. USB can not update the firmware. Only update the firmware via the programming port.

For example:

void setup() {
pinMode(100,OUTPUT);
}

void loop() {
}

Because this pin number 100 is not available, the program will go wrong, bootloader can not start

digitalWrite() unnecessarily activates the pull-up resistor on the specified pin

digitalWrite() unnecessarily activates the pull-up resistor on the specified pin.

the issue with the pull-up in digitalWrite(),
(other than the fact that this line shouldn't be there),
is because the pin configuration register (PINCFG) isn't logically ORed with the bit mask when the pull-up bit (PULLEN) is enabled,
instead the mask is copied directly into the register.
This effectively clears all the other bits in the register including the input enable (INEN).

in addition this issue makes the code not forward/backward compatible to AVR code
(digitalRead therefore cannot read back the current value of a digital PIN configured as OUTPUT.)

--> https://forum.arduino.cc/index.php?topic=367517.msg2534096#msg2534096
--> http://forum.arduino.cc/index.php?topic=334073.msg2306580#msg2306580

openocd recipe has bootloader 0 (no prot?)

heya folx - i was writing a tutorial and noticed that your recipe for openocd programming the bootloader is

tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown"

in particular the "at91samd bootloader 0" is required to unset bootloader protection before uploading, so thats good. however, that protection is never re-set with "at91samd bootloader 8192" or something after programverify.... I'm pretty new to openocd but thought it was worth checking :)

USB host library conflicts with Due USB host library

samd

The library manager recommends updating the USB host library to 1.0.4 but this version does not work on Zero. If the update is done, the keyboard example does not compile. I do not see any way to suppress this message.

IDE 1.6.7 and SAMD board version hourly build.

USB host library 1.0.4 works fine on Due so there is nothing wrong with the library.

1200bps reset unreliable

When uploading using the native usb port, uploading fails every other time. I think that after the first failed upload the board is left running the bootloader, which is what allows the second attempt to succeed. This happens both with the arduino zero (native usb port) and my own modulo controller. It does not happen will non-samd boards such as the arduino micro.

Here's the sequence of events that I'm seeing:

  1. Press upload (using the Blink sketch for this test)
  2. 1200bps reset occurs
  3. upload port is found
  4. bossac FALS with the error: "No device found on cu.usbmodemXXXX"
  5. Press upload
  6. 1200bps reset occurs
  7. upload port is found
  8. bossac succeeds.

Here's the output from a failed upload:

Sketch uses 10,988 bytes (4%) of program storage space. Maximum is 262,144 bytes.
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem1411
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem1411, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem1411, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/tty.Bluetooth-Incoming-Port, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/tty.Bluetooth-Incoming-Port, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/tty.Bluetooth-Incoming-Port, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/tty.Bluetooth-Incoming-Port, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/tty.Bluetooth-Incoming-Port, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/tty.Bluetooth-Incoming-Port, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem1411, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem1411, } => {/dev/cu.usbmodem1411, /dev/tty.usbmodem1411, }
Found upload port: /dev/cu.usbmodem1411
/Users/ekt/Library/Arduino15/packages/arduino/tools/bossac/1.6.1-arduino/bossac -i -d --port=cu.usbmodem1411 -U true -i -e -w -v /var/folders/7z/hphfkcsx0nq7cdntfsf967g00000gn/T/buildd5ae82e677127ac286f51de66781d807.tmp/Blink.ino.bin -R 
No device found on cu.usbmodem1411

Is it possible that the bootloader takes too long to initialize the port and bossac runs before the port is ready?

Also I think this may have started happening after upgrading to OS X El Capitan. I haven't tested it on other operating systems but can do so if that's helpful.

Thanks a lot!

[PATCH] Wire library: coding unnecessarily complex

In the wire library there are several functions where an - unnecessarily - complex coding has been used:
endTransmission: the availability of data is already checked in while(...), therefore need not be checked again in the loop.
requestFrom: the for-loop has a predefined and fixed number of loops. Therefore a check whether the last element has been reached is unnecessary and does not add any benefit.

Attached are two patches to simplify these functions:

--- ArduinoCore-samd.orig/libraries/Wire/Wire.cpp   2015-07-16 10:36:01.416937191 +0200
+++ ArduinoCore-samd/libraries/Wire/Wire.cpp    2015-07-16 19:17:07.675799549 +0200
@@ -132,12 +132,8 @@ uint8_t TwoWire::endTransmission(bool st
       sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
       return 3 ;  // Nack or error
     }
-
-    if(txBuffer.available() == 0)
-    {
-      sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
-    }
   }
+  sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);

   return 0;
 }
--- ArduinoCore-samd.orig/libraries/Wire/Wire.cpp   2015-07-16 19:17:07.675799549 +0200
+++ ArduinoCore-samd/libraries/Wire/Wire.cpp    2015-07-16 19:24:33.179778166 +0200
@@ -66,22 +66,15 @@ uint8_t TwoWire::requestFrom(uint8_t add
     rxBuffer.store_char(sercom->readDataWIRE());

     // Connected to slave
-    //while(toRead--)
-    for(byteRead = 0; byteRead < quantity; ++byteRead)
+    for(byteRead = 1; byteRead < quantity; ++byteRead)
     {
-      if( byteRead == quantity - 1)  // Stop transmission
-      {
-        sercom->prepareNackBitWIRE(); // Prepare NACK to stop slave transmission
-        //sercom->readDataWIRE(); // Clear data register to send NACK
-        sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); // Send Stop
-      }
-      else // Continue transmission
-      {
-        sercom->prepareAckBitWIRE();  // Prepare Acknowledge
-        sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_READ); // Prepare the ACK command for the slave
-        rxBuffer.store_char( sercom->readDataWIRE() );  // Read data and send the ACK
-      }
+      sercom->prepareAckBitWIRE();  // Prepare Acknowledge
+      sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_READ); // Prepare the ACK command for the slave
+      rxBuffer.store_char( sercom->readDataWIRE() );  // Read data and send the ACK
     }
+    sercom->prepareNackBitWIRE(); // Prepare NACK to stop slave transmission
+    //sercom->readDataWIRE(); // Clear data register to send NACK
+    sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); // Send Stop
   }

   return byteRead;

If this is the wrong place to provide patched please guide me to the right place. I have more patches that I would like to share.

Arduino Zero <avr/sleep.h>

From @mitko9000 on June 22, 2015 7:31

When trying to compile nordic nrf8001 arm support library it says missing <avr/sleep.h>
is that some kind of a issue or just this miscrocontroller is not supporting this library ?

Copied from original issue: arduino/Arduino#3393

analog write frequency too high

the analogWrite output pwm frequency(48M/256 = 187.5k) is too high for most h-bridge based motor drive, for example TB6612, which may cause the chip over heat. A reasonable driving frequency is around 20k for most motors.

Sketch stops working when WiFi.h is included

I tried to use the WiFi examples on the zero (in particular ScanNetworks). It doesn't work. I made some test and i notice that even this simple sketch

#include <SPI.h>
#include <WiFi.h>

void setup() {
  Serial.begin(115200);

  Serial.println("Serial started");

  while(1);
}

void loop() {
}

stops working when WiFi.h is included

IDE1.6.6 ubuntu 14.04

digitalRead() broken on pins in output mode.

Apparently "pinMode(pin, OUTPUT)" will clear the INEN bit for the GPIO pin in question, preventing digitalRead() (or direct port access) from being able to read the current output state of an output pin, and breaking trivial statements like:
digitalWrite(13, ! digitalRead(13)); // toggle LED
As far as I can tell, there should never be a reason to disable input on the GPIO pins (PORT_PINCFG_INEN bit cleared in pincfg), except maybe when the pin is used for analog input.

http://forum.arduino.cc/index.php?topic=367517

No Valid JTAG Error

I got a new Zero from arduino.cc, followed the getting started (Windows), and succeeded running a simple program, using the Programming Port. But on 32 or 64 bit Ubuntu, I can't upload the bits. Both cases give the error below. I also used the hourly version on 64 bit and got the same result.

These same machines have been used for an Uno for quite some time, so there should not be any generic problems with the USB, /dev/tty# etc. The port also shows up properly, and with an addition to the rules file, I can pop the console without error.

Just in case it mattered, I installed bossa and bossa-cli as follows:
sudo apt-get install bossa-cli
sudo apt-get install bossa

I did not expect this to matter based on the error, just pugging possible holes.

Perhaps there is some magic needed in a configuration file somewhere?

Open On-Chip Debugger 0.9.0-gd4b7679 (2015-06-10-18:22)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Error: unable to find CMSIS-DAP device
Error: No Valid JTAG Interface Configured.

writing LOW to a digital input pin blocks subsequent digitalRead attempts

I noticed while trying to add Arduino Zero support for Firmata that the following line fails: https://github.com/firmata/arduino/blob/master/examples/StandardFirmata/StandardFirmata.ino#L266.
After that point, digital input will not work on that pin (it's not permanently broken as in fried input pin or anything like that though). This has never been an issue for other architectures.

One one hand this points out that I need to update the Firmata implementation to use INPUT_PULLUP, something I should have probably added long ago. On the other hand this is an inconsistency so just calling that out.

This may be the same issue as #28.

Zero Bootload Compile Error

When compiling with Atmel Studio 7.2 this error occurs:

board_driver_led.h(23,17): error: sam.h: No such file or directory
#include <sam.h>
^
compilation terminated.

I've tried locating the file manually or including it in the project.

Does this bootloader compile against ASF?

Serial Port baud rate divider is set incorrectly, fails to generate low baud rates correctly

From SERCOM::initUART

    // Asynchronous arithmetic mode
    // 65535 * ( 1 - sampleRateValue * baudrate / SystemCoreClock);
    // 65535 - 65535 * (sampleRateValue * baudrate / SystemCoreClock));
    sercom->USART.BAUD.reg = 65535.0f * ( 1.0f - (float)(sampleRateValue) * (float)(baudrate) / (float)(SystemCoreClock));

As per Table 24-2 of Atmel-42181G–SAM-D21_Datasheet–09/2015, constant in formula should be 65536, not 65535. Also no rounding is performed to take float to closest integer.

Zero min() and max functions don't compile

Trying to compile code like this on the Zero:

int test = min(1,2);

results in "error: 'min' was not declared in this scope
'min' was not declared in this scope". Same problem for max().

Note: tested on 1.6.5 running on OS X.

spi on other pin

I have custom boad with atsamd21e18 with micro sd card connected to
miso a19
mosi a16
sck a17
ss a18
I want try zero audio but I can change only ss pin, but I have no idea when I can use another spi pins. I think that all pins I used are another spi connected to edbg chip. thanks

Wire.requestFrom() differences AVR / SAMD

Moved from: arduino/Arduino#4329

@extrapixel:

Repeated calls to beginTransmission()/ write() / endTransmission() / requestFrom() behaves differently on AVR and SAM. I think they should either:

  • behave the same or
  • be documented properly

On UNO:
Wire.requestFrom(XxXX, n);
if the received data is shorter than 'n' or not all data is read via Wire.read(), the Wire.available() buffer is empty in the next iteration.

on ZERO
Wire.requestFrom(XxXX, n);
if the received data is shorter than 'n' or not all data is read via Wire.read(), the Wire.available() buffer is not empty, but padded with '0' characters up to 32 bytes and these stay in the buffer even in the next iteration

(same for IDE 1.6.6 and 1.6.8 hourly 2015/12/21 04:13 )

USBHost calls wiring core init() by accident?

hey so this only comes up if you do some modifications to the example code but Init() in the USBHost library calls init()
yet there is no "init()" in the library...there used to be in the original library
https://github.com/arduino-libraries/USBHost/blob/f563445a39da22798bd7985ad3faf857dfacda4e/src/Usb.cpp#L42
but that code is now just in Init.

so instead it ends up calling wiring's init() call, which resets GCLK and some other things. you can change the init() call to add other args to see where the call ends up

C:\Users\ladyada\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.2\libraries\USBHost\src\Usb.cpp:40:16: error: too many arguments to function 'void init()'

  init(1,2,3,4,5);

                ^

In file included from C:\Users\ladyada\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.2\cores\arduino/Arduino.h:84:0,

                 from C:\Users\ladyada\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.2\libraries\USBHost\src\Usb.cpp:20:

C:\Users\ladyada\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.2\cores\arduino/wiring.h:25:13: note: declared here

 extern void init(void);

fix is just removing the call to init()

attachInterrupt() will not work with sleep mode (known as standby mode for ATSAMD21G18A)

When putting the Arduino Zero to sleep through the standby function call (provided by RTCZero) and using the attachInterrupt() to wake the processor, device will not be able to wake up. The EIC_WAKEUP register needs the pin corresponding WAKEUPENx bit set as mentioned in section 20.8.9 of the SAMD21 datasheet to enable the attachInterrupt to wake the processor during standby.

Warning in USBCore.cpp:649:8

I'm getting the following warning when trying to compile any of the examples with the SmartEverything board:

In member function 'uint32_t USBDeviceClass::send(uint32_t, const void*, uint32_t)':
\arduino\hardware\samd\1.6.2\cores\arduino\USB\USBCore.cpp:649:8: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
data += length;
^

.... Reset not supported for this CPU.

after upload to board via native port I have message

Verify successful
done in 0.047 seconds
CPU reset.
Reset not supported for this CPU.

I need manually reset board

CPU is Atsamd21E18 is specially unsupported E version?
Is problem with bootloader or upload software?

HardwareSerial BUG Rx pin floating input

Rx pin should be set to the pull-input at begin

fix this bug as follows
file Uart.cpp line 37

void Uart::begin(unsigned long baudrate, uint8_t config)
{
  pinMode(uc_pinRX,INPUT_PULLUP);//Rx pin set INPUT_PULLUP mode,
  pinPeripheral(uc_pinRX, g_APinDescription[uc_pinRX].ulPinType);
  pinPeripheral(uc_pinTX, g_APinDescription[uc_pinTX].ulPinType);

  sercom->initUART(UART_INT_CLOCK, SAMPLE_RATE_x16, baudrate);
  sercom->initFrame(extractCharSize(config), LSB_FIRST, extractParity(config),        extractNbStopBit(config));
  sercom->initPads(uc_padTX, uc_padRX);
  sercom->enableUART();
}

file SERCOM.cpp line 118

void SERCOM::clearStatusUART()
{
  //Reset (with 0) the STATUS register
  //sercom->USART.STATUS.reg = SERCOM_USART_STATUS_RESETVALUE;
   sercom->USART.STATUS.reg = 0xFF;//Writing a zero to this bit has no effect.,Writing a one to this bit will clear it.
}

tone function random crashes

This sketch will crash after several minutes running on Arduino Zero. Serial output stops, and the frequency on pin 5 becomes approx 258 kHz.

void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 1500) ;
  delay(10);
  Serial.println("Tone Issue Test");
  delay(20);
}

void loop() {
  int frequency = 1500 + random(800);
  tone(5, frequency);
  Serial.println(frequency);
  delayMicroseconds(random(10000));
}

Behaviour of Uart::flush() differs from AVR

On AVR Uart::flush checks TXC0 and waits until transmission is complete.

From hardware/arduino/avr/cores/arduino/HardwareSerial.cpp
while (bit_is_set(*_ucsrb, UDRIE0) || bit_is_clear(*_ucsra, TXC0)) {

On SAMD Uart::flush checks DRE
while(sercom->USART.INTFLAG.bit.DRE != SERCOM_USART_INTFLAG_DRE);

DRE is cleared when the data register is empty but the shift register might not be - giving a false early indication the transmission is complete. SERCOM::flush should check TXC in the same manner as AVR.

I'm working with instrumentation at 1200 baud, when I flush I need to tristate the serial line, with the current implementation the last character is corrupted because the flush returns early.

SerialUSB receive data error

arduino Zero using SerialUSB communicate with computer,the received data once more data than before, to be wrong.

Unable to set the number of data bits on serial port in Uart::begin due to data type width

These constants for the number of data bits are all 16 bit values.

#define HARDSER_DATA_5      (0x100ul)
#define HARDSER_DATA_6      (0x200ul)
#define HARDSER_DATA_7      (0x300ul)
#define HARDSER_DATA_8      (0x400ul)
#define HARDSER_DATA_MASK   (0xF00ul)`

But Uart::begin takes an 8 bit value
void begin(unsigned long baudrate, uint8_t config);

This makes it impossible to change the number of bits.

String() class fails to construct properly with floats and doubles

Hitting an issue where using Arduino's String class constructor fails to create a string when given an initial value that is a float or a double.

Simple repro: Serial.print(String(1.1)) doesn't print anything.

A repro program is attached. This program works when targeting an Uno. This is with the following two packages installed:
◾Arduino SAMD Boards (32-bits ARM Cortex-M0+), version 1.6.2
◾Arduino SAMD Core - (build 1), version 1.6.2-build-2

string_bug_repro.txt

SMBus Support

The SERCOM file does not support repeated start, therefore SMBus transactions are not possible in Wire.

Can someone explain how to compile the serial library and put it into play? I would be happy to try to add support for repeated start. Im working on Ubuntu, so it would be nice to compile with a gcc toolchain, etc.

I work on SMBus stuff a lot, so I don't need handholding on the protocol. When done, the LTC PMBus library will eventually release to the public for anyone to use. Today it only works on Uno, Mega, etc.

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.