maple serial on Android?

Post here first, or if you can't find a relevant section!
WindyYam
Posts: 31
Joined: Mon Aug 07, 2017 2:39 am

Re: maple serial on Android?

Post by WindyYam » Sat Jan 27, 2018 7:17 am

ag123 wrote:
Sat Jan 27, 2018 5:28 am
i tend to use Serial.available() to check if there is data in the queue so that to an extent i did some kind of 'non-blocking' reads
Thanks but what I'm blocking is in PC side. The serial.BytesToRead I got in C# call is always 0. but when it comes to a Arduino uno or CP2102 adapter everything runs fine

User avatar
Pito
Posts: 1743
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: maple serial on Android?

Post by Pito » Sat Jan 27, 2018 8:32 am

For Android you want to install a driver for Maple Serial USB (Uno uses the FTDI, and the CP21xx as well have got drivers for all OSes)..
You may try, for example, the BlueTooth HC-05 module. Will work sure. And wireless :)
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 857
Joined: Thu Jul 21, 2016 4:24 pm

Re: maple serial on Android?

Post by ag123 » Sat Jan 27, 2018 9:53 am

WindyYam wrote:
Sat Jan 27, 2018 7:17 am
Thanks but what I'm blocking is in PC side. The serial.BytesToRead I got in C# call is always 0. but when it comes to a Arduino uno or CP2102 adapter everything runs fine
if you are waiting for data on the PC side, you would need to send some data from maple (mini) or bluepill
i.e. use Serial.write(c); to send that data over. test out your skech in the serial terminal in arduino IDE for instance

the link i've given earlier is a usb-serial dongle sketch done with the maple mini
viewtopic.php?f=18&t=2752
you could use similar codes to test some kind of request / response using serial.read() or serial.write(c)

if you are having problems on the PC side it sounds likely you have a serial.read() call which blocks (on maple mini) and it stalls there. you could try out the serial.available() hack/workaround i used to do 'non-blocking' reads i posted earlier

User avatar
RogerClark
Posts: 7693
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: maple serial on Android?

Post by RogerClark » Sat Jan 27, 2018 11:13 am

It expects DTR to be set

If you can’t set this, use the Zumspot branch of my repo, as that version was for a device which had the same problem

Note, the Zumspot branch does not get updated that often, but I updated it 2 weeks ago, so it’s fairly up to date at the moment.

WindyYam
Posts: 31
Joined: Mon Aug 07, 2017 2:39 am

Re: maple serial on Android?

Post by WindyYam » Sat Jan 27, 2018 1:16 pm

RogerClark wrote:
Sat Jan 27, 2018 11:13 am
It expects DTR to be set
many thanks, by setting DtrEnable = true the code start to work as normal Arduino Uno does :)

I will deal with the Android version later

User avatar
RogerClark
Posts: 7693
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: maple serial on Android?

Post by RogerClark » Sat Jan 27, 2018 9:18 pm

As the AVR Arduinos and the Due etc, don’t require DTR to be set, the Core really needs to be updated to make it operate the same as the rest of the Arduino world.

However, when I looked it changing this, it had an impact on the blocking functionality of the USB Serial.

We had a poll about whether USB Serial should be blocking but I can remember the results .

But we definitely can’t have a situation where the code hangs, if USB Serial is not connected, as some libraries have print statements in them, and most projects do not end up with the board being deployed connected to a USB host

User avatar
mrburnette
Posts: 2232
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: maple serial on Android?

Post by mrburnette » Sat Jan 27, 2018 9:36 pm

RogerClark wrote:
Sat Jan 27, 2018 9:18 pm
... as some libraries have print statements in them ...
IMHO, no library should have print statements! Example of where such a thing makes sense?

Ray

User avatar
RogerClark
Posts: 7693
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: maple serial on Android?

Post by RogerClark » Sat Jan 27, 2018 9:52 pm

I agree

Libraries should not have print statements in them, but in the past I think I came across one or two libraries which still had print statements in them, left over from when they were debugging the lib.

User avatar
mrburnette
Posts: 2232
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: maple serial on Android?

Post by mrburnette » Sun Jan 28, 2018 1:35 am

RogerClark wrote:
Sat Jan 27, 2018 9:52 pm
I agree

Libraries should not have print statements in them, but in the past I think I came across one or two libraries which still had print statements in them, left over from when they were debugging the lib.
Ah, ha!
These lines are ideal candidates for the "// " prefix. Even the lowly ArduinoIDE editor can manage this task.

ag123
Posts: 857
Joined: Thu Jul 21, 2016 4:24 pm

Re: maple serial on Android?

Post by ag123 » Sun Jan 28, 2018 3:50 am

mrburnette wrote:
Sat Jan 27, 2018 9:36 pm
IMHO, no library should have print statements! Example of where such a thing makes sense?

Ray
unfortunately sd fat actually tries to scream on the serial console at initialization if it can't connect to the sd card, yup it is useful as quite a number of times i forget to insert the sd card :lol:

Code: Select all

	// Initialize at the highest speed supported by the board that is
	// not over 50 MHz. Try a lower speed if SPI errors occur.
	if (!sd.begin(chipSelect, SD_SCK_MHZ(50))) {
		sd.initErrorHalt();
	}

Post Reply