How to open a serial connection w/daisyLib

Hi,
I’m having trouble finding useful examples for really simple things with the Daisy Seed. I’m using VSCode for editing and compiling and uploading using make and make program-dfu on Linux using the non-Arduino daisylib.
My question is, are there any simple examples of how to open a serial port? There are some vague un-commented examples I found on serial messages over the USB port, but what about communicating to other devices over Serial?
Any help? Thanks.

You have examples in STM32Cube library (from STMicroelectronics) of two boards communicating through serial protocol using UARTs.

Hi
I’m bit late to the party , but this might help

Connect Daisy Usart 1 to a Host PC

You need to purchase a Serial to USB converter
In the UK I bourght one of these
https://www.amazon.co.uk/gp/product/B075N82CDL/ref=ppx_yo_dt_b_asin_title_o06_s00?ie=UTF8&psc=1

And just wire the TX and Rx pin ( no need to wire up anything else) of this to the Daisy’s USART1 Rx & USART1 TX, remember swop TX and RX
TX ----> Rx
RX <— TX

On your PC you should then see the Serial Port to use ( gets added once
you connect) Daisy <—> USB/Serial convert <----> computer Port
On mine it presented itself as “Silicon Labs CP210x USB to Uart” on Port 9
This is what you’ll open in what ever Serial port monitor app you use.

Connect to another Serial Port e.g. another processors Uart
Then you will not need the USB/Uart converter.
just swop over Tx Rx

Daisy Code Example

Below is a very basic/simple serial port usage

In main.cpp define a method as follows

	SerialDebugWriteString( const char txBuffer[],  int bufferSize){ 
		PollTx((uint8_t *)&txBuffer[0],  bufferSize);
	}

then instance the uart

uint8_t rxBuffer[16];

      UartHandler uart;
        uart.Init();
    	
    	//set input buffer to 16 chars
        uart.StartRx(16) ;

    	// write something to the serial port
      SerialDebugWriteString("hello", 5);

To read the serial port

      //read bytes from the serial port
      size_t   rxCount = uart.Readable();
            if(rxCount > 0){
    			//ReadBlock is a method you have to add to per_uart.cpp
                uart.ReadBlock(rxBuffer, rxCount);
                uart.FlushRx();
            
            }

In libdaisy/src add the following , then recompile ( make )

in per_uart.h

void ReadBlock(uint8_t *destination, size_t num_elements);

in per_uart.cpp

void UartHandler::ReadBlock(uint8_t *destination, size_t num_elements){
    uhandle.queue_rx.ImmediateRead(destination, num_elements);
}

Important
In per_uart.cpp you’ll see the baud rate etc set in the method void UartHandler::Init()
Make sure you have the correct baud, data bits, stop bits etc.

Hope this helps

Hi… After you unplug, plug within the dongle to the machine, do you see a serial harbour gadget show up within the /dev organizer? What is the title, read/write consents (ls -l /dev)? The prior pyOpenBCI mistake may have been due to a gadget title jumble or consents issue. The Nano runs what variation of Linux? In the event that it is Ubuntu as the look results suggest, you might have a record consents issue with the gadget. It should have both examined and type in authorizations for proprietor or gather. And in some cases those are as it were turned on for a specific gather by default.