Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SAMD #2

Closed
sabas1080 opened this issue Nov 20, 2018 · 24 comments
Closed

Support SAMD #2

sabas1080 opened this issue Nov 20, 2018 · 24 comments

Comments

@sabas1080
Copy link

Hi

Support SAMD21 or SAMD51??

Thanks!

@Naguissa
Copy link
Owner

Hello,

I have none of that micros so I can try to code it but you should do the tests. Could you help me with that?

Thanks.

@sabas1080
Copy link
Author

of course i can help

@Naguissa
Copy link
Owner

Thanks!

Any preference about timer number? I tend to use last timers. As currently I'm woking on SAMD21 and this chip has 3 and 5 TCs versions I was planning to use last one, TC2....

Cheers!

@sabas1080
Copy link
Author

TC2 or TC3 is good for me

@Naguissa
Copy link
Owner

I've added support for ESP8266 (mostly tested) and SAMD21 on master.

Also I've updated some documentation and added SAMD21 datasheet to extras folder.

It's using Timer2 (3rd timer).

Could yo give it a try? At least it doen't complain when compiling....

@sabas1080
Copy link
Author

Compiling ok, but not working

@Naguissa
Copy link
Owner

Fixed a copy-paste bug.

Could you try it?

You can try Serial examples, as in some ARCHs LED doesn't work (at least on ESP8266, as it has no user LED, correctly defined at least).

If it fails again, can you describe the symptoms: nothing on Serial console, no repeated event, etc...

@Naguissa
Copy link
Owner

Oh! You need to download master, as I've not created a release because it's not stable....

@sabas1080
Copy link
Author

Ok, testing

@sabas1080
Copy link
Author

I have tried with an MKR1300 and a Bast pro mini and not working examples of led and serial

@Naguissa
Copy link
Owner

Could you try this example?

https://github.com/maxbader/arduino_tools/blob/master/libraries/timer_zero_tc_interrupt/timer_zero_tc_interrupt.ino

I've taken most of the code from there; maybe it's not working....

@sabas1080
Copy link
Author

not working blink and serial 🤔

@sabas1080
Copy link
Author

I have tried with this library too, but it does not work :(

https://github.com/adafruit/Adafruit_ZeroTimer

@Naguissa
Copy link
Owner

It's quite strange both links doesn't work for you.

I've made some fixes and enhancenments, could you try again?

Also, you could you try this code? https://arduino.stackexchange.com/questions/41569/arduino-zero-timer-setup

I'll order two boards (SAMD21 and SAMD51), but they'll take some weeks to arrive (specially because we are in Christmas peak now, and we have a lot of delays here, usually).

Thanks.

@Naguissa
Copy link
Owner

P.S.: Remember to download master version: https://github.com/Naguissa/uTimerLib/archive/master.zip

@sabas1080
Copy link
Author

Example https://github.com/maxbader/arduino_tools/blob/master/libraries/timer_zero_tc_interrupt/timer_zero_tc_interrupt.ino working in pin 11, in LED_BUILTIN not working.

But examples of uTimer not working in pin 11

@Naguissa
Copy link
Owner

Naguissa commented Dec 3, 2018

Hello again. I've deleted one extra flag, but code is equivalent to the one that works.

Check this:

  • Download / install master again
  • Open this example: uTimerLib_setInterval_s_example_led
  • Replace LED_BUILTIN for any known pin
  • Test it.

Should change pin status each 2 seconds...

@sabas1080
Copy link
Author

Not working

@Naguissa
Copy link
Owner

Naguissa commented Dec 4, 2018

I found the problem. SAMD21 and SAMD51 follow different define structure to identify them. I'll finish some touches and I'll push some hanges including SAMD51 support.

@Naguissa
Copy link
Owner

Naguissa commented Dec 4, 2018

OK, SAMD21 and SAMD51 correctly added. Please, try it and give feedback.

Problem was I was using:

ARDUINO_ARCH_SAMD21
ARDUINO_ARCH_SAMD51

But architecture itself is always ARDUINO_ARCH_SAMD; I need to use:

_SAMD21_
__SAMD51__

(yes, it's not a typo, 21 has one surrounding "_" and 51 has two)

I've added a pragma telling support is experimental; I'll remove it if it's working and publish a new release.

@sabas1080
Copy link
Author

not working in MKR1300 pin 11

@Naguissa
Copy link
Owner

I received SAMD21 board yesterday. I've changed the code for a functional version.

But my perception is that timing is not perfect, it seems to be a little shorter than indicated (something like 1.8seconds if you specify 2 seconds).

Still, drafted a new release, 1.0.0 one.

To test it you may need to change LED_BUILTIN for a digital pin, if your board has no user LED (as my board happens to be).

@sabas1080
Copy link
Author

Gracias, ahora trabaja bien, he visto que tienes un foro en español, saludos

@Naguissa
Copy link
Owner

SAMD51 moved to #3

Sí, soy de Barcelona, España.

Saludos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants