Split from: ADC outputting 0,1023 (or 255)

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi @mikech,

 

I am trying to understand the functioning of the ADC on my UC3 device and having followed several posts, I got here.

 

The code is from a project in which the originator had the following setting for clocks:

OSC0 - 16MHz

PLL0 - 96Mhz

MainClock - 48MHz

PBA/PBB Clock -24MHz

CLK_ADC = PBA CLK = 24Mhz

 

static void setMainClock(void)
{
    //// Enable the external Osc0 of 16Mhz
    pm_enable_osc0_crystal(&AVR32_PM, FOSC0);
    
    pm_enable_clk0(&AVR32_PM, 0x00000003);
    
    ////Enable the PLL at 96MHz
    pm_pll_setup(&AVR32_PM, 0, 2, 0, 0, 16);
    
    //////PLL output VCO frequency at 48MHz
    //pm_pll_set_option(&AVR32_PM, 0, 0, 1, 0);
    pm_pll_set_option(&AVR32_PM, 0, 1, 1, 0);
    
    //////Enable PLL0
    pm_pll_enable(&AVR32_PM, 0);
    
    ///////Wait for PLL0 locked
    pm_wait_for_pll0_locked(&AVR32_PM) ;
    
    //////Set PBA and PBB clocks by 2 from main clock at 24 MHz
    pm_cksel(&AVR32_PM, 1, 0, 1, 0, 0, 0); //default
    
    /////Set PLL0 as main clock to 48MHz
    pm_switch_to_clock(&AVR32_PM, AVR32_PM_MCSEL_PLL0); //default
}

 

AVR32_ADC.mr |= 0x4 << AVR32_ADC_MR_PRESCAL_OFFSET; // ~ 4.8 MHz

From the "AVR32_ADC.mr |= 0x4 << AVR32_ADC_MR_PRESCAL_OFFSET; // ~ 4.8 MHz" is this correctly 4.8MHz or 2.4MHz? My calculations says it is 2.4MHz but the comments indicate 4.8MHz. And I am now somehow confused.

 

Also, how do I set/change sampling frequency of an UC3's ADC. The originator claimed he was using a sampling frequency 250Hz, but I can not see where to set such frequency. Please guide me.

 

Last Edited: Fri. Jun 29, 2018 - 08:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Working through the code ;
pm_pll_setup(&AVR32_PM, 0, 2, 0, 0, 16); gives a mul of 2 and a div of 0 to the PLL which multiplies OSC0 by 2*(2+1) = 6 which gives a PLL Vco of 96 MHz.
pm_pll_set_option(&AVR32_PM, 0, 1, 1, 0); divides PLL Vco by 2 which gives a potential system clock of 48MHz.
pm_cksel(&AVR32_PM, 1, 0, 1, 0, 0, 0); //default takes the main system clock and divides it by 2 to produce the PBA and PBB clocks of 24MHz.
The scaling is 2^(sel+1) and 'sel' is 0 for the PBA and PBB.
(The //default comment is incorrect because the default is for no division of the PBA/PBB/HSB clocks).
The ADC prescale is given as 4 which divides the PBA clock by (4+1)*2 = 10, hence the ADC clock is 2.4MHz and the // ~ 4.8 MHz comment is incorrect (or was correct before someone decided to divide the PBA clock).


As for the sampling frequency, that will depend on what is triggering the ADC conversions.
The datasheet says that the ADC can be triggered from a timer or an external input, but my version of the datasheet doesn't go into much detail about those triggers.
Personally, I would just configure a timer for your desired sample-rate and then trigger a conversion off that. (eg. via a timer-interrupt or via frequent checking of the compare-status flag in the timer SR)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the response again @mikech.

 

I did not realise you have replied till I came checking the site again (I usually do receive email alerts).

 

Your response has given me a good understanding of configuring the ADC. I was thinking the 2.4MHz was the sampling rate before, not realising there was need to be a timer-interrupt. I will get to fix this timer-interrupt and hopefully i will achieve my target sampling frequency of 250Hz. That I plan to do with: cpu_delay_us(4000, 3*BOARD_OSC0_HZ);

 

A side question is- is the ADC clock of 2.4Mhz sufficient? What guides the setting/configuration of this clock?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the Electrical Characteristics section of the datasheet there is a subsection which describes the ADC characteristics.
For the UC3Axxx the maximum ADC clock is 5 MHz for 10-bit conversions and 8 MHz for 8-bit conversions.
With a 5 MHz ADC clock the maximum throughput rate is 384 kSPS (which is the result from 3 ADC clocks for the sample-and-hold plus 10 for the conversion),
therefore with a 2.4 MHz ADC clock you should get approximately 2.4E6/13 = 184 kSPS throughput.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the clarification @mikech.

 

I am still in some troubles as it seems my ADC is not performing as expected. I am sampling on 2 channels (tagged I and Q in the code below) at the (supposedly) rate of 250Hz. In 60 seconds, I was expecting 250*60*2 = 30000 samples at the receiver end (a RPi connected to my user board via 3-wire UART) but the samples are either above the expected value or way below it. I guess I am missing something- implementation of the sampling rate?, UART baudrate?, cpu_clocking?

 

I kindly ask for further help in suggesting what could be wrong given the adapted program code as below:

 

/*
 * adc.c
 *
 * Created: for ADC and U(S)ART
 *  Author: obabarin
 */ 


//do header and lib insertions
#include ""
#include <>

////USART defines
#define USART				(&AVR32_USART3)
//to be defined in init.c
#define TARGET_PBACLK_FREQ_HZ	BOARD_OSC0_HZ
#define USART_RX_PIN		AVR32_USART3_RXD_0_0_PIN
#define USART_RX_FUNCTION	AVR32_USART3_RXD_0_0_FUNCTION
#define USART_TX_PIN		AVR32_USART3_TXD_0_0_PIN
#define USART_TX_FUNCTION	AVR32_USART3_TXD_0_0_FUNCTION

#define AVR32_SCIF_OSCCTRL0_STARTUP_2048_RCOSC	0x00000003

////Data formatting
#define NUM_IQ			75
#define NUM_SFCW		121

//Global variable declarations
int Nm[4][32];

uint32_t Target_VCO_CAP_Address = 0;
uint32_t calibration[41];
double	Ftune = 0.0;


//Variables to store I/Q samples (2 channels of ADC to be used)

#if defined(I_CHANNEL)
unsigned long Isample = 1;
#endif

#if defined(Q_CHANNEL)
unsigned long Qsample = 1;
#endif

unsigned long temp1 = 1;
unsigned long temp2 = 1;

/////-------------

////CPU clock settings
static void setMainClock(void)
{
    //// Enable the external Osc0 of 16Mhz
    pm_enable_osc0_crystal(&AVR32_PM, FOSC0);
    
    pm_enable_clk0(&AVR32_PM, 0x00000003);
    
    ////Enable the PLL at 96MHz
    pm_pll_setup(&AVR32_PM, 0, 2, 0, 0, 16);
    
    //////PLL output VCO frequency at 48MHz
    pm_pll_set_option(&AVR32_PM, 0, 1, 1, 0);
    
    //////Enable PLL0
    pm_pll_enable(&AVR32_PM, 0);
    
    ///////Wait for PLL0 locked
    pm_wait_for_pll0_locked(&AVR32_PM) ;
    
    //////Set PBA and PBB clocks by 2 from main clock at 24 MHz
    pm_cksel(&AVR32_PM, 1, 0, 1, 0, 0, 0); //default
    
    /////Set PLL0 as main clock to 48MHz
    pm_switch_to_clock(&AVR32_PM, AVR32_PM_MCSEL_PLL0); //default
}

static void local_start_gc(void)
{
    
    // setup a generic clock
    pm_gc_setup(&AVR32_PM, AVR32_PM_GCLK_GCLK0, 1, 0, 0, 0);
    
    /* Enable Generic clock */
    pm_gc_enable(&AVR32_PM, AVR32_PM_GCLK_GCLK0);
    
    /* Set the GCLOCK function to the GPIO pin */
    gpio_enable_module_pin(7, 1);//PA07
    
    
}

//{insert other functions for configuring user board here
    
//}


int main (void)
{
    uint8_t IQsamples[74];
    uint8_t SFCWsamples[121];
    //IQsamples[0] = 0x4C; //number of samples,0x4c=76d ie 1bit for sensor ID and 75 bits
    //SFCWsamples[0] = 0x78;
            
    int j;
    int k;
    int singletone;
    //int multitone;
    uint8_t IQbuff[1]; ////buffer to hold IQsamples converted from binary to decimals and sent as string
    
    
    
    
    setMainClock();
    
    local_start_gc();
    
    volatile avr32_adc_t *adc = &AVR32_ADC;
    
    board_init();
        
    AVR32_ADC.mr |= 0x2 << AVR32_ADC_MR_PRESCAL_OFFSET;   //4.0 MHz with prescale of 2 => ADCCLOCK = CLK_ADC/((PRESCAL+1)*2). where CLK_ADC = PBA_CLK
    
    adc_configure(adc);
    
    // Enable the I/Q ADC channels.
    #if defined(I_CHANNEL)
    adc_enable(adc, I_CHANNEL);
    #endif
    #if defined(Q_CHANNEL)
    adc_enable(adc, Q_CHANNEL);
    #endif
    
    // Initialize interrupt vector table support.
    irq_initialize_vectors();
    
    // Enable interrupts
    cpu_irq_enable();
    
    #if defined(__GNUC__) && defined(__AVR32__)
    setbuf(stdout, NULL);
    setbuf(stdin, NULL);
    #endif
    
    static const gpio_map_t USART_GPIO_MAP =
    {
    {USART_RX_PIN, USART_RX_FUNCTION},
    {USART_TX_PIN, USART_TX_FUNCTION}
    };
    
    // USART options.
    static const usart_options_t USART_OPTIONS =
    {
        .baudrate     = 115200,
        //.baudrate     = 57600,
        //.baudrate     = 9600,
        //.baudrate     = 1200,
        .charlength   = 8,
        .paritytype   = USART_NO_PARITY,
        .stopbits     = USART_1_STOPBIT,
        .channelmode  = USART_NORMAL_CHMODE
    };
    
    usart_init_rs232(USART, &USART_OPTIONS, BOARD_OSC0_HZ*1.5); //use when fPBA is 24Mhz, 
    ////usart_init_rs232(USART, &USART_OPTIONS, FOSC0*1.5);
    
    while(1){
        
        //// call user board functions
        
            for(singletone=0;singletone<20;singletone++){//for1
                ////for(singletone=0;singletone<80;singletone++){//for1
                
                //AVR32_GPIO.port[0].ovrc = 1 <<6;	// Switch connected to Radar
                cpu_delay_us(1000, 1.5*BOARD_OSC0_HZ);
                k=0;
                                
                for(j=0;j<25;j++){//for2
                    //				TxBits(0x5,0x00000F88); // VCO Subsystem 3 - enable RF output stage
                    //				cpu_delay_us(1000, 3*BOARD_OSC0_HZ);
                    
                    // launch conversion on all enabled channels
                    adc_start(adc);
                    
                    // Acquire the I/Q channels
                    Isample = adc_get_value(adc, I_CHANNEL);
                    Qsample = adc_get_value(adc, Q_CHANNEL);
                    
                    ////format adc samples into bytes
                    // Creating byte 1
                    temp1=0x8000;
                    temp2 =((Isample & 0x00000300) << 5 );
                    temp1=(temp1 | temp2);
                    temp1= ((temp1 | 0x1000) >> 8  );
                    temp2=((Isample & 0x000000F0) >> 4);
                    IQsamples[k] = (uint8_t)(temp1 | temp2);
                    
                    // Creating byte 2
                    temp1 =((Isample & 0x0000000F) << 4 );
                    temp1= (temp1 | 0x08);
                    temp2= ((Qsample & 0x380) >> 7);
                    IQsamples[k+1] = (uint8_t)(temp1 | temp2);
                    
                    // Creating byte 3
                    temp1=0x80;
                    temp2= ((Qsample & 0x7F));
                    IQsamples[k+2] = (uint8_t)(temp1 | temp2);
                    
                    //				TxBits(0x5,0x00000D88); // VCO Subsystem 3 - disable RF output stage
                    
                    if (k<75) {
                        cpu_delay_us(4000, 1.5*BOARD_OSC0_HZ); //sampling frequency of 250Hz = 1/4000us
                    }//if
                    
                    k=k+3;
                    
                                        
                }//for2
                
                
                /////send CW data over uart here using a for_loop////////////////////////////
                                
                for (int a = 0; a < 75; a++){//for3
                    sprintf(IQbuff, "%d;", IQsamples[a]);  ////convert content of IQsamples to decimals and 'print' to IQbuff
                    usart_write_line(USART, IQbuff);
                    
                }//for3
                
                usart_write_line(USART, "\r\n");
                
                ////usart_write_line(USART, "ABCDEF\r\n"); //test transmit
                ////}old try
                
                
                
                cpu_delay_us(4000, 1.5*BOARD_OSC0_HZ);
                
            }//for1
            
        
    }//while
    
    
}//main

Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The reason for the variations in received samples is due to the sprintf(IQbuff, "%d;", IQsamples[a]);
because it will cause 2, 3 or 4 characters to be eventually transmitted.
sprintf(IQbuff, "%3d;", IQsamples[a]); would be better because it will always send 4 characters.


You will need to tweak the time-delays in the sampling and transmitting loops to cater for the time used in data-acquisition/calculation and the time used to send the serial data.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks again @mikech.

 

Can you please clarify to me the difference between fcpu_hz as used in cpu_delay_us(unsigned long delay, unsigned long fcpu_hz); and pba_hz as used in usart_init_rs232(volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz);?

Is there an instance (such as in my configuration) when fcpu_hz = pba_hz?

 

In my case I am certain the pba_hz is 24Mhz, but could not figure what the fcpu_hz is.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does the datasheet not give a description of the clocking & clock distribution system ?

 

Your post #1 shows setting up a whole bunch of different clocks ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sure it does give on pg 54 of the AT32UC3A datasheet. I was asking to be double sure I did the right configuration and to clear my doubt.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

They should be the same unless you start dividing the system clocks.
The reset-default is for no clock-division therefor the clocks for the CPU, PBA, PBB and HSB busses are identical.
The ASF time-delay routines use the SYSTIMER counter which is on the CPU clock buss, the USARTs are on the PBA clock buss.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oooops.,
my sprintf(IQbuff, "%3d;", IQsamples[a]); suggestion will only work for positive values of IOsamples[]
sprintf(IQbuff, "%4d;", IQsamples[a]); will cater for positive and negative values.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This does really 'work' as expected. Since IQsamples are formatted already to uint8, I found doing sprintf(IQbuff, "%d;", IQsamples[a]); was just what I needed.....

 

All the same, I still keep losing data on my transmission connection. I have tried:

> using slower and higher sampling rates- as low as 50Hz and as high as 500Hz

> faster baudrates- as high as 921600bps

> tweaked time between data transfer

 

All to no avail. For short time data recording, few bytes are lost, but this could accumulate for something large in long time accumulation. Feels like I may have to throw in the towel and just use what I have so far.

 

More suggestions are welcome.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
... Since IQsamples are formatted already to uint8, I found doing sprintf(IQbuff, "%d;", IQsamples[a]); was just what I needed.....
:puzzled:, are your samples always within a range of 0-9, 10-99 or 100-255 ?


What exactly are you 'losing' and how do you know you are losing it ?
Is it because there are occasional missing characters ? (the captured human-readable data 'looks' inconsistent and is not nicely formatted),
or are there occasional missing 'records' of 75 samples ? (a sequence-number at the beginning (or end) of each burst of transmitted samples could help)


Losing a few bytes can be caused by ;
- the interface between the micro and the RPi. (is it direct ?, via a TTL<->USB converter or a RS232<->USB converter, or ... )
- the serial-data subsystem in the RPi. (the USART or USB driver)
- the data-capture program in the RPi.

To localise the problem area I would use a different device to transmit test data to the RPi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

are your samples always within a range of 0-9, 10-99 or 100-255 ?

 My samples are always within 0-255. Since my signal is centred (dc offset) at around 1.6V, I do get samples around 0d191 and 0's when the communication line is closed as the signal fades down to 0V. This looks to me to be very correct and expected.

 

What exactly are you 'losing' and how do you know you are losing it ?
Is it because there are occasional missing characters ? (the captured human-readable data 'looks' inconsistent and is not nicely formatted),
or are there occasional missing 'records' of 75 samples ? (a sequence-number at the beginning (or end) of each burst of transmitted samples could help)

I timed the RPi to acquire transmitted samples for a knonw time. On putting the acquired data in an Excel or Matlab file, I can count the collected samples and will see missing data. I will think this is usually towards the end of the data and not some occassional missing characters. For examples, I know that when I perform ADC at 250 Hz, and format the samples into bytes as given the the previous code, there will be 750bytes/sec (2  10-bits channel with 4 extra bits added to make 3 bytes for boy channels as each sampling period). For when acquisition is for 5 secs, transmitted data will be 3750 bytes, which are sent (and received) 75 bytes each. Meaning my Excel sheet/Matlab file should be a 75 by 50 ( rows vs columns) matrix but my data is always short of one or two full columns. 

 

I experimented with data acquisition for a bit longer than 5 secs such as 5.1-5.5 secs and found that I could actually acquired all data with slightly above 5secs. This looks to me to be a timing problem- probably with the CPU of the RPi not calling the accurate time or my code is buggy (which i have rechecked several times).

 

To localise the problem area I would use a different device to transmit test data to the RPi.

My interface between custom board (with microcontroller and adc) to RPi is a 3 wire cross connection. I will take in this suggestion, troubleshoot into other things  and get back to you all.

 

Thanks for all the help and readiness to help me actualise the working of this project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

By Rpi I take it you mean Linux, have you used termios to switch off any buffering?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

 

My receiving code on the RPi is as follows:

 

#include <stdio.h>
#include <unistd.h>			//Used for UART
#include <fcntl.h>			//Used for UART
#include <termios.h>		//Used for UART
#include <stdlib.h>
#include <string.h>

#include <wiringPi.h>
#include <time.h>

#include <sys/time.h>


int main(int argc, char **argv){

/////-------------------------
	//----- SETUP USART 0 -----
	//-------------------------
	//At bootup, pins 8 and 10 are already set to UART0_TXD, UART0_RXD (ie the alt0 function) respectively
	int uart0_filestream = -1;
	
	//OPEN THE UART
	//The flags (defined in fcntl.h):
	//	Access modes (use 1 of these):
	//		O_RDONLY - Open for reading only.
	//		O_RDWR - Open for reading and writing.
	//		O_WRONLY - Open for writing only.
	//
	//	O_NDELAY / O_NONBLOCK (same function) - Enables nonblocking mode. When set read requests on the file can return immediately with a failure status
	//											if there is no input immediately available (instead of blocking). Likewise, write requests can also return
	//											immediately with a failure status if the output can't be written immediately.
	//
	//	O_NOCTTY - When set and path identifies a terminal device, open() shall not cause the terminal device to become the controlling terminal for the process.
	//uart0_filestream = open("/dev/ttyAMA0", O_RDWR | O_NOCTTY | O_NDELAY);		//Open in non blocking read/write mode, default
	uart0_filestream = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);		//Open in non blocking read/write mode
	if (uart0_filestream == -1)
	{
		//ERROR - CAN'T OPEN SERIAL PORT
		printf("Error - Unable to open UART.  Ensure it is not in use by another application\n");
	}
	
	//CONFIGURE THE UART
	//The flags (defined in /usr/include/termios.h - see http://pubs.opengroup.org/onlinepubs/007908799/xsh/termios.h.html):
	//	Baud rate:- B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800, B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000, B2500000, B3000000, B3500000, B4000000
	//	CSIZE:- CS5, CS6, CS7, CS8
	//	CLOCAL - Ignore modem status lines
	//	CREAD - Enable receiver
	//	IGNPAR = Ignore characters with parity errors
	//	ICRNL - Map CR to NL on input (Use for ASCII comms where you want to auto correct end of line characters - don't use for bianry comms!)
	//	PARENB - Parity enable
	//	PARODD - Odd parity (else even)
	struct termios options;
	tcgetattr(uart0_filestream, &options);
	//options.c_cflag = B9600 | CS8 | CLOCAL | CREAD;		
	//options.c_cflag = B115200 | CS8 | CLOCAL | CREAD;		
	//options.c_cflag = B57600 | CS8 | CLOCAL | CREAD | PARENB | PARODD;		//<Set baud rate
	options.c_cflag = B921600 | CS8 | CLOCAL | CREAD | PARENB | PARODD;
	options.c_iflag = IGNPAR;
	options.c_oflag = 0;
	options.c_lflag = 0;
	tcflush(uart0_filestream, TCIFLUSH);
	tcsetattr(uart0_filestream, TCSANOW, &options);
	
	
	
	FILE*file = fopen("/home/pi/Documents/myC/Data/dataStart1108_.txt","w"); //writes to file while creating new file at every run
	
	
	///declare time variables
	unsigned int t; //t being in seconds
	time_t start, end;//
    struct timeval timecheck;
    double timespent;
    
    
    ///initialise start
    gettimeofday(&timecheck, NULL);
    start = (long)timecheck.tv_sec * 1000 + (long)timecheck.tv_usec / 1000;
    
	
//while(1){//while
for (t=0;1;t++){
	if (uart0_filestream != -1){
		
		unsigned char rx_buffer[75];
		
		
		int rx_length = read(uart0_filestream, (void*)rx_buffer, 75);
		
		if (rx_length < 0)
		{
			//An error occured (will occur if there are no bytes)
		}
		else if (rx_length == 0)
		{
			//No data waiting
		}
		else
		{
			//Bytes received
			rx_buffer[rx_length] = '\0';
			
			printf("%s", rx_buffer);
			
			fprintf(file, "%s", rx_buffer); //stores data to file (data.txt)
							
		}//else
		
	}//if
	



	///check time of prog run
	gettimeofday(&timecheck, NULL);
    end = (long)timecheck.tv_sec * 1000 + (long)timecheck.tv_usec / 1000;
        
    ///break after set time
    timespent = (double)(end- start); 
	if (timespent >= 60*1000) //(time count in millisecs)
		break;
 
//}//while   
}//for 
	printf("%ld milliseconds elapsed\n", (end - start));
	
	fclose(file);//close file
	
////closing uart
////----- CLOSE THE UART -----
	close(uart0_filestream);
	
	
	
return 0;
	
	
}//main

Anyone see anything unusual? Please help improve on it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe the termios falg to be disabled is ICANON so I think you achieve that when you do:

options.c_lflag = 0;

For more info see talk of "canonical" in this page:

 

http://man7.org/linux/man-pages/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, i will think so too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Addendum:

 

The choice of baud rate (equal value set on each device) has an effect on the amount of data received/acquired. My AT32UC3A1512 microcontroller seems to support maximum baudrate of 1000000bps. From my data formatting I only have 6000bit available for transmission per second.