due 16u2 update serial garbage

Hi
is the serial garbage fixed by downloading board upgrades through the ide, or do i have to download the older version of the ide to use with the upgrade description

AFAIK once UART is properly programmed, there is no garbage received in the serial monitor.

cheers ard
by that do you mean not to solely rely on the arduino setup is there xtra work to do ie,datasheet

this is my setup

void setup()
{
	Serial.setInterruptPriority(2);
	Serial.begin(115200);
		
	Serial.flush();
	SI.empty_serial_buffer();	//reads until buffer empty

this is the function out put on the serial monitor

Opening port
Port open
Choose from codes below
---------------------------------------
Code	Description
X	Exit without making selection
1	26 pin data recorder
2	To record pulse timing on a single pin
3	To record timing and count of a series
	of pulses, on a single pin

this is the same function run a second time with further output

Choose from codes below
---------------------------------------
Code	Description
X	Exit without making selection
1	To use default data reco    <-----stops here sometimes garbage, sometimes not

this is what should be printing

//options for initial configure setup
int configure_opt;

const int config_choices = 2;
constexpr int config_opt[config_choices] {1, 2};

String config_opt_msg[config_choices]
{
	"To use default data recorder settings",	//1
	"To setup with new data recorder settings"	//2    <------ should be printing here
};
//end configure setup

this is the function

bool SerInput::check_for_int_input(int &dest, const int src[], const int src_size, String msg[])
{
	bool ret			= false;
	bool print_once		= true;
	bool reading		= true;
	bool input_match	= false;
	int number_in		= 0;
	char input[10];
	int input_idx		= 0;
	
	while(input_match == false)
	{
		//header print
		if(print_once == true)
		{
			print_single_input_header();
			print_exit_option();
			
			for(int i = 0; i < src_size; i++)
			{
				//long buff_sz = Serial.availableForWrite();
				//Serial.println(buff_sz);
				//long tl = msg[i].length();
				//Serial.println(tl);
				Serial.print( src[i] );		Serial.print('\t');		Serial.println( msg[i] );
				//buff_sz = Serial.availableForWrite();
				//Serial.println(buff_sz);
				//printf(" %s \n", "my test message");
				
				Serial.flush();
			}
			print_once = false;
			//delay(2500);
			
		}
		
		//read input
		while(reading == true)
		{
			if(Serial.available() > 0)
			{
				input[input_idx] = Serial.read();
			
				if(input[input_idx] == 'X')
				{
					input_match		= true;
					reading			= false;
					Serial.println("Exiting ");
					break;
				}
				
				if(input[input_idx] == '\n')
				{
					reading	= false;
					break;
				}
				
				if( ++input_idx > 10 )
				{
					reading	= false;
					empty_serial_buffer();
					break;
				}
			}
		}
			
		number_in = atoi(input);
		//validate against array
		for(int k = 0; k < src_size; k++)
		{
			if(number_in == src[k])
			{
				input_match		= true;
				ret				= true;
				dest			= number_in;
				Serial.println("Confirmed: ");
				Serial.print("\t");
				Serial.println(msg[k]);
				break;
			}
					
		}
				
		if(input_match == false)
		{
			reading = true;
			input_idx = 0;
			memset( input, 0, sizeof(input) );
			Serial.println("Incorrect entry, choose one of the codes above");
			Serial.flush();
		}		
	}
	
	Serial.println(header_seperator);
	Serial.println();
	Serial.flush();
		
	return ret;
}

I don't understand why you are using "Serial.setInterruptPriority(2);". It's not a good idea to modify UART interrupt priority unless you really know what you are doing.

You have a very simple example of a Serial reading from Serial monitor at:

File > Example > Communication > SerialEvent

then, depending on your Serial inputs (plus carriage return) you select the corresponding routine and you are done.

Select 250000 as Serial baud rate.

i changed the priority because i want the pin change interrupts of the program to happen when they happen not wait for serial functions to complete.

do you use clones or genuine boards

Hi joeblogs

attachinterrupt in Winterrupts.h has received a major improvement done by antodom thanks to the count leading zeros assembler instruction, and AFAIK this version (except the register type) has been implemented in the latest versions. See this thread reply #106 :

https://forum.arduino.cc/index.php?topic=144446.105

I use clone boards too.

cheers

i am slowly getting to the problem i think,

does any one know why the following example causes the serial monitor to not print anything at all

struct fred { const char id[3]; const char msg[64]; };     <-------- 64

struct fred x[2]
{ 
	{ { "12" }, {"test message 1"} } ,
	{ { "21" }, {"test message 2"} }	
};		


void PrintString(const char *str) {
	const char *p = str;
	//p = str;
	while (*p) {
		//printf(p);
		Serial.print(*p);
		p++;
	}
	Serial.println();
}




void setup()
{
	Serial.begin(115200);
	
	PrintString(x[1].id);
	PrintString(x[1].msg);
}

yet if i change 64 in the first line of code to 30 it works fine.

im starting to think the garbage i was getting was an out of bounds buffer array

Your code works fine with 64, no garbage in Serial monitor.

cheers ard
just for a laugh, i removed the file from the project, and then added it again, rebuilt it, 2 day problem solved
(using AS7)

out of interest whats your IDE preference

and some stupid twat left an array initialized at 7500 which worked fine until storing const strings :o