Uart serial help please


#1

I think I am missing a very simple step somewhere here, but I am unable to make sense of what is happening with my uart serial connection between Axo and Arduino.

My arduino code is simple, the data received as a byte, if it is greater than 0, then it turns on, an LED.

This works when the value goes over 0..

But this does not..

This is the first hook up of the uart on the axo, testing to make sure it all works, and I need it to send values to the arduino between 0 and 2000 for my official setup.

Do you know what I am missing.:cry:

Thanks..


#2

Please attach your patch...


#3

Thanks @Johannes,
I won't be able to attach the patch till later, but even though I selected embedded edit, I made no mods to the code.
The objects are used from factory exactly as shown.
In the second one, the middle object is just the "convert to fractional output" object, with absolutely no mods to the code, and "script2_1" is from your serial test patch with absolutely no mods to the code. All stock standard. Apologies for not stating that sooner.

One of the things I may need to give consideration to, is the Arduino is a Leonardo clone, so I had to implement the "Soft Serial" library. It has some limits, maybe this is one of them with the Axo, like can't send and receive at the same time, but I am only receiving here, on the Leo I can only use certain I/O pins for it which I have done. I have a Nano I can use instead with the proper serial hardware, I think I will have to use this instead. Just a lot of rewiring to do..


#4

Could you check connecting PA2 to PA3 and reading back, like the gpio/serial/serial help patch demonstrates? This would eliminate if the problem is situated at the Axoloti side or at the Arduino side.

My (old) experience soft serial on arduino was painful, unable to do anything while receiving or expecting to receive data.


#5

Thanks Johannes,
PA2 to PA3 works fine. I have even tested it passing through a logic level converter between PA2 and PA3 and that worked fine. I wasn't keen on using soft serial, was just hoping to have a use for the leo clone I have,
I will definitely setup the Nano.

Then one last simple question, in the help patch you have the script 2 module setup with fractional inputs and outputs only, as I am not very familiar with STM code you have in this module, so unable to determine any limits to the code, if I adjust the inputs to Int32's I should not have any issues sending integers down the line providing they are not more than 16 bit ?

Thanks..


#6

Thanks @johannes,
My Due's finally arrived from snail mail today so I hooked one of these up to test the UART, and everything works fine.
Thanks for your help, you might think you didn't do much, but getting it out stopped me from going nuts.. :grin:


#7

:slight_smile:
Identifying the source of a problem by elimination is an approach I'd often recommend.

sdPut(&SD2, x);
only sends one byte (8 bit) to the serial output. To transmit and receive multiple bytes, there is
sdWrite(&SD2, data, n);
Or to transmit a formatted string, use
chprintf(&SD2,"x=%d\n", x)

Keep in mind that a serial port only transports bytes, if you want to transport multi-byte messages, the receiving side needs to be able to figure out where the message starts. Therefore you need to encapsulate the messages in some sort of protocol, like sending a packet header before the data, and detecting this packet header at the receiving end.
Using formatted text strings to transmit numerical data is possible but quite inefficient.


#8

Thanks again @johannes
As 0 to 255 will give best performance, if I can rethink strategy around this, there should be benefits.
Scrap the 8 rotary encoders, 2 banks idea (10 arrived yesterday):unamused:.
Maybe 2 rotary encoders, one to change the parameter, one to change the value. Will likely end up with far more than 16. Just thinking out loud !... :grin:
Maybe this can finally be an object I design that I can post for all to use. Kind of select a parameter to adjust through a demux etc, then adjust parameters value with + or -. Well got the weekend ahead of my to get stuck into. DOH ! :scream: have to swap out the Arduino Nano for the Arduino Leonardo first.. Solder, Solder, Solder. !