sixfab / tinylab

tinylab : prototype easier than ever
https://sixfab.com/product/tinylab-exclusive-kit/
GNU General Public License v2.0
73 stars 48 forks source link

Tinylab - Software Serial #9

Open mugekuskon opened 2 years ago

mugekuskon commented 2 years ago

Hello,

I wanted to ask whether it is possible to use the SoftwareSerial library in tinylab? Most of the pins are occupied, so I couldn't managed to use the library. I hope you have an advice.

Müge

ozgurtzc commented 2 years ago

Hi, @mugekuskon

There are DIP switches on TinyLab. With these switches, you can connect to the components on the card. If you do not want to access any component and you want to make an output from the female connectors with the help of jumpers, you should control the DIP switches. Because UART protocol is normally used on point-to-point link and does not define a "bus" as such. More than one output cannot use the same line.

Also, if you want to use UART in interrupt mode, you should pay attention to the pins you will use.

SoftwareSerial library has the following known limitations:

It cannot transmit and receive data at the same time.

If using multiple software serial ports, only one can receive data at a time.

Not all pins support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

mugekuskon commented 2 years ago

Thanks for your immediate answer. Actually, I am not willing to use SoftwareSerial library as we can use Serial1 in Leonardo. My code is working well in the Arduino IDE; however when I try to install RIOT on Tinylab, and upload my code with "avrdude -c avr109 -p m32u4 -P /dev/tty.usbmodem14101 -U flash:w:/U...../bin/arduino-leonardo/tinylab_thingspeak.hex" command, it gives me an error such as "/arduino_sketches.cpp:72:4: error: 'Serial1' was not declared in this scope; did you mean 'Serial'?". In order to avoid this error, I included HardwareSerial.h in my code, and the error was gone. I personally don't think this is the correct action that I should've taken, since my code is not sending any data to Thingspeak now. (it used to send temperature, potentiometer etc. data when I ran that code in Arduino IDE).

To sum up, I wanted to ask you whether there is a file or anything else that I should include in my folder in order to tinylab acts the same when a code is uploaded with avrdude from terminal as it is in arduino IDE. (I tried all these operations in a Ubuntu VM in Windows 11, an Ubuntu machine and lastly in a MacBookAir 2013)

Thanks in advance, Müge

ozgurtzc commented 2 years ago

avrdude is a customized upload and download tool just for avr microcontrollers. avrdude allows you to read or write just by accessing your microcontroller's ROM or RAM. Therefore, it cannot interfere with the code.

It seems to me that the problem is with RIOT's source library. RIOT has already said here that they do not support all the arduino features. See

Arduino Leonardo also uses Serial1 USB(CDC) Virtual COM port. When I examine RIOT's Wiki site, I see that it does not support USB(CDC) anyway. See