SerialportCommunication

Hi,
I am using mangohred 7502 module. i am trying serial port program between host to target . I tried DM COM and all other com ports in terminal in windows. I am using max232 and voltage level shifter yf08E. I mapped uart to 17,1 and i used /dev/hs0 . i am posting the program below. in .adef file i added [rw] /dev/hs0 /dev/hs0 also. I am unable to read/write data from/to the terminal. please guide me to establish communication.
Thanks and regards,
K Subrahmaniam

#include “legato.h”
#include “interfaces.h”
#include <le_tty.h>
#include <unistd.h>
#include <string.h>

//void uartInit();
COMPONENT_INIT
{
le_result_t result;
char buffer[20]= “Hello\n”;
// int readSerial;
int i=0;
int len;
//printf(“hI”);
const char *serialport = “/dev/ttyHS0”;

int fd = le_tty_Open(serialport, O_RDWR|O_NDELAY|O_NOCTTY|O_NONBLOCK);
if(fd == -1)
    {
    	//LE_FATAL("Error Opening %S err[%d]: %s", SERIAL_PORT,errno,strerror(errno));
    	LE_INFO("failed");
    }
else
	LE_INFO("SUCCESS opening");
    LE_INFO("%d", fd);
 le_tty_SetBaudRate(fd,13);
 char parity = 'N';

 le_tty_SetFraming(fd,parity,8,1);

 result = le_tty_SetCanonical(fd);
 		if(result == LE_OK)
 			LE_INFO("canonical mode is set");

 do
 {

	 LE_INFO("Enter do while loop");
	len = write(fd,buffer,6);
	sleep(2);
 LE_INFO("Number of bytes writen is %d",len);

	// readSerial = read(fd,buffer,sizeof(buffer));
	// LE_INFO("Read bytes are:%d",readSerial );

//	 LE_INFO(buffer);
	 i++;

	/* if(readSerial > 0)
	 {
		 LE_INFO("Read bytes are:%d",readSerial );
		 for(i=0;i<readSerial;i++)
		 {
			 printf("%c",buffer[i]);
		 }printf("\n");
	 }
	 else
	 {
		 printf("error readSerial = %d\n",readSerial);
	 }*/
 }while(1);
 le_tty_Close(fd);

}

Is it ok if you disable the sandbox feature?

I tested it with disabling sandbox also please guide me

What is the result then?

maybe you can have a look on these topics:

The sample code there should be working with UART.

Hi,
I tested with sandbox disabled . I am unable get the data . should i do any mux or binding settings, I connected cf3 to pc. i connected iot connector to connect the serial port. In that iot 12 and 13 pins are used for tx rx pins . form that i give to max232 via vlotage level shifter. i set 17,2 in uart mapping, i used ttyhs0 and tried ttyhsl1 . should i include any bindings or mux ? please guide me
Thakyou
K Subrahmaniam

have you tried the application in the link I provide to you?

17,2 uart mapping is for uart2 ,not uart1

Hi good morning,
Can you guide me to write http program to get and put . We are getting curl errors . Is http necessary to implement sota . Aiantage apis are also giving errors .
Thanks and regards,
K subrahmaniam

you can try the sample application httpGet.