Uploading program to teensy not working - arduino

i got a brand new Teensy 3.2 with the blinking LED programm on it.
When I now tried to upload another programm on the teensy, Arduino says:
Teensy did not respond to a USB-based request to automatically reboot.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
The automatically starting window of Teensy, doesn't give me a chance to (for example) reboot the Teensy as well, so something of the connection seems to be wrong or something, but what...
Even if I mannualy press the pushbutton, it's still not possible to upload something. Any ideas why?

I have encountered this problem twice. The first I tossed out the board. This time, when I power it, it runs the last program I burned on it, but when I try to program it again, the LED stops blinking and everything stops.
The claim that it might not be a data cable is not reasonable, because how can it stop the current program unless it was told to. I doubt very much that +5V can provide such commands.
I have tried different cables, different USB ports, rebooting my Linux box, reinstalling (twice), checking the pins on the Teensy and the cable... no clue.
It always boots up in the old app (I left the blinker running to indicate "liveness"). I had programmed a message to come out the hardware serial port. Could that have been the problem? Wait... Is there a way to set the baud rate on the USB? I wonder if that is the problem! --
Banner(void) {
Serial.begin(9600);
Serial1.begin(115200);
};
The example had me programming the USB serial! I bet that is the problem! Better yet, does anyone know what the protocol is for talking to USB serial commander?

Under Ubuntu 18.04 install this https://www.pjrc.com/teensy/49-teensy.rules file into /etc/udev/rules.d

Related

How to fix Failed to connect to ESP32: Timed out waiting for packet header error?

I tried to flash an ESP32 but I didn't succeed, I tried with esptool.py and Arduino IDE. I tried to press the boot button and reset but it didn't work. Here is the error:
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
If using the Arduino IDE, try lowering the upload speed (Tools/Upload Speed). Lowering mine from 921600 to 460800 did the trick.
First ensure that you are in download mode:
Start the serial monitor and set the speed (mine is 115200).
While pressing the "boot" button, press and release the "en" button (your buttons may be labeled differently).
You should see something like this on the serial monitor:
waiting for download
Now start the upload
My development machine, a 2013 iMac is connected via USB to the USB-c port on my ESP32 Dev Module. Apparently the iMac's USB or ESP32 board's USB cannot keep up at the 921600 upload speed.
DISCLAIMER! May not be correct answer but may help to save time for someone.
Quick answer if you do not want read my experience: Disconnect all wires from pins and try uploading again! It may help.
I came across with the same error and could not figure it out. I first thought that something is wrong with the code, because it happened after I edited working code while figuring out where to connect what pin 😀. I also wasn't able to upload simple HelloWorld after it happened with connected wires. But then I disconnected all my wires from the board and the upload works fine.
I can not figure out the WHY factor but I think it must had been the input/data pin I was using, in my case D13. I have the DevKit with fewer pins. Maybe someone can comment why connected pins may make the error come up?
To make your ESP32 board go into flashing/uploading mode automatically, you can connect a 10 μF electrolytic capacitor between the EN pin and GND. When I had the same problem, when I followed this advice, the problem was solved.
References
Failed to connect to ESP32: Timed out waiting for packet header
espressif/arduino-esp32 - issue
On some AliExpress-like ESP32s you have to press the boot button in order to upload your sketch.
If you are watching the Arduino IDE console ouput and Connecting ... appears, you have to press the boot button for approximately 2 seconds until the console output changes.
Try to do this one after the other
Press the boot button when press uploading button until it write the code.
Try disconnect esp32 from the board/header/pcb that you are using right at the time.
Disconnect any other connection that your esp32 might have.
Do not connect to anything even your hand if possible.
Try put it in something that doesnt have a moist surface. look pic number 3.
MY CASES(30 pin version):
Case 1: I dont know why. I was connecting the pin to a female header it doesnt work and sometimes it just work like that. look pic number 1.
Case 2: when Im holding esp32 on my hand sometimes it wont work then i put it on my table and another time it doing well.
Case 3: pressing boot button when uploading it helped sometimes, and the other time it just work like it should.
Case 4: when it connected to pcb its simply just wont work, but when disconnected boom it work like nothing ever happen. look pic number 2.
Maybe just maybe something with capacitive or something like that (just assuming because number Case 1). hope that will help you out.
pic 1pic 2pic 3
This technique definitely working
Goto Tools > programmer, Select ISP and Upload Your Code.
if you can't see any programmer, then download 1.8.12 version.
https://www.arduino.cc/en/software/OldSoftwareReleases
With Arduino IDE
Make sure the Com port is selected under Tools menu. My experience with ESP32 is Com 5.
If it is not available as an option, try changing USB ports and/or re-select Tools - Board - ESP32 dev module.
Watch the "Compiling Sketch" window.
Press the "Boot" button as soon as you get the red message "Serial port Com 5" You can release the button as soon as it starts to upload.
If this doesn't work,try plugging into another USB port.
The Reset button only resets the uploaded sketch to re-initialise and has nothing to do with the uploading.
Install expressif.exe and port drivers,connect the port and flash the esp32 ,upload the code using ardiuno,solve the error
in my case buttons are new but not shorting properly as multimeter showed ..opened both scratched resoldered and all working
Changing by upload speed from 921600bps to 115200bps fixed it. No need to press any buttons.
Just download the drivers x)
CP210x: CP210x USB to UART Bridge VCP Drivers
FTDI: FTDI Virtual COM Port Drivers

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

Arduino com port keeps getting busy

I have got an Arduino Uno R3 on which I have an accelerometer that I'm playing a bit with. This setup has worked for quite a while now, everything working from uploading to checking the serial output.
Today I started having problems with the com port reporting busy or not connected at all. When I use the default IDE it cant find the arduino at all but when I use a modded IDE (Arduino ERW 1.0.5) seems to find the port to communicate on but it reports it being busy.
I have reinstalled the driver like 5 or 6 times now and searched for any other driver that might work but they wont change anything. I have also checked that my pc actually detects the arduino which it does, it is listed among the COM ports on Device Manager. I also tried changing the Com port from COM3 to COM4 and still it worked for like 3 uploads and then the COM port kinda "disappeared" from the serial port list on the IDE.
EDIT: Weirdly, after closing some programs that seem to have to do with serial communication it works. I have to look into what I close and when.
EDIT2: For now it seems that processing sometimes didnt close properly when not using the stop button on the processing application which then didnt close the connection to the arduino. I havent had any problems since I started to use the Stop button on processing.
Win 8.1
Latest driver and IDE(an modded IDE called Arduino ERW 1.0.5 seem to work a bit better but have the same issues)
One thing I noticed is that if I press the reset button when it starts again it wont send anything through serial, is it defaulting to the Blink program after a reset or what?
For those getting the "port busy" error while connecting Arduino and Process, one fix is to close the serial monitor in Arduino.
For anyone who is struggling with this, you have to give again rw rights to ttyACM0
sudo chmod a+rw /dev/ttyACM0
after that I was able to open the serial port.
I found the problem being in Processing itself, on win 8.1 the P3D option for 3D renderer seems to leave the java process open after closure which causes the serial port to be busy even after the main window is closed.
I simply fixed it by using OPENGL instead of P3D which didn't change anything visibly so I'm fine with it.

avrdude: stk500v2_ReceiveMessage(): timeout

This is the main error that I get when I try to run my ARDUINO program. The full list of errors is as follows:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
My code is as follows:
int led=13;
void setup()
{
pinMode(13,OUTPUT);
}
void loop()
{
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
I have tried updating the drivers (they are fully updated) and downloading some programs. I have Windows 7 and my arduino is a MEGA 2560. It shows up in the Device Manager and all of my connections are correct. The green PWR light is on and so is the flashing L light. The RX and TX lights flash when I update. I have tried almost everything on the web. What is the problem?
Another possible reason for this error for the Mega 2560 is if your code has three exclamation marks in a row. Perhaps in a recently added string.
3 bang marks in a row causes the Mega 2560 bootloader to go into Monitor mode from which it can not finish programming.
"!!!" <--- breaks Mega 2560 bootloader.
To fix, unplug the Arduino USB to reset the COM port and then recompile with only two exclamation points or with spaces between or whatever. Then reconnect the Arduino and program as usual.
Yes, this bit me yesterday and today I tracked down the culprit. Here is a link with more information: http://forum.arduino.cc/index.php?topic=132595.0
The error message basically means that the programmer is unable to contact the bootloader on the device; the code you're trying to upload has no bearing on the problem.
What causes this can be numerous and varied, some possible issues:
UART communications
Blinking is happening, so hopefully you aren't using the wrong port. It might be worth checking again though, sometimes USB COM devices install on strange port numbers.
Connect TX to RX (and disconnect them from the AVR if possible) then open a terminal on the COM port, you should see characters echoed if you type them. If you don't, something is wrong up-stream of the chip, it could be the communications chip (I think the Arduino 2560 uses a secondary AVR instead of an FTDI for some reason, so that could be broken, either its software or hardware)
ATmega* bootloader
The AVR is not executing the bootloader for some reason. If the programmer is not resetting the micro before attempting to connect, this might be the reason. Try to reset the AVR (press and release the button) while the programmer is attempting to connect. Sometimes software that runs in a tight loop will prevent the bootloader from connecting.
Barring that, the fuses might have gotten messed up or the code erased. You would need to reflash the bootloader and proper fuses, again, see the appropriate info page for your device.
Arduino Mega 2560 only: ATmega8U/16U software
Might not be working and would need reprogramming. See the Programming section on the info page, you will need the firmware and Atmel-compatible DFU (device firmware update) software on your computer to reflash the target.
Hardware damage to the board, AVR(s), or FTDI chip
You're hosed; need a new chip.
Check this forum post for some more ideas.
I got this error because I didn't specify the correct programmer in the avrdude command line. You have to specify "-c arduino" if you are using an Arduino board.
This example command reads the status of the hfuse:
avrdude -c arduino -P /dev/ttyACM0 -p atmega328p -U hfuse:r:-:h
To my humble understanding, this error arises in different scenarios:
you have selected the wrong port or you haven't at all. go to tools > ports and select the com port with your Arduino connected to.
you have selected the wrong board. go to tools > board and look for the right board.
Do you have one of these Arduino replicas or you don't have the boot-loader installed on the microcontroller? I don't know the solution to this! if you know please edit my post and add the instructions.
(windows only) you don't have the right drivers installed. you need to update them manually.
sometimes when you have wires connected to the board this happens. you need to separate the board from any breadboard or wires you have installed and try uploading again. It seems pins 0 (RX) and 1 (TX), which can be used for serial communication, are problematic and better to be free while uploading the code.
Sometimes it happens randomly for no specific reason!
There are all kinds of solutions all over the internet, but sometimes hard to tell the difference between magic! Maybe the Arduino team should think of better compiler errors to help users differentiate between these different causes.
The same problem happened to me and none of the solutions above worked. What happened was that I was using an Arduino UNO and everything was fine, but when I bought an Arduino Mega 2560, no matter what sketch I tried to upload I got the error:
avrdude: stk500v2_ReceiveMessage(): timeout
And it was just on one of my windows computers and the other one was just ok out of the box.
Solution:
What solved my problem was to go to tools > boards > Boards Manager... and then on the top left of the opened windows select updatable in the Type section. Then select the items in the list and press update on the right.
I'm not sure if this will solve everyone's problem, but it at least solved mine.
Open Terminal and type:
$ sudo usermod -a -G dialout
(This command is optional)
$ **sudo chmod a+rw /dev/ttyACM0**
(This command must succeed)
This isn't really a fixing solution but it may help others. Unlike Nick had said for me it was due to code in my program. I have the mega ADK model. The issue was tied to a switch statement for processing and parsing the returned byte[] from the usb connection to the Android. Its very strange because it would compile perfectly every time but would fail as the OP had stated. I commented it out and it worked fine.
I was running this code from Arduino setup , got same error resolve after changing
serial port to COM13
GO TO Option
tool>> serial port>> COM132
If you use the ino command line:
ino upload
it can be because you use the arduino software at the same time, try to kill it.
I've connected to USB port directly in my laptop and timeout issue has been resolved.
Previously tried by port replicator, but it did not even recognized arduino, thus I chosen wrong port - resulting in timeout message.
So make sure that it is visible by your OS.
Ensure the serial monitor is not running and nothing is reading/writing dev/tty/S0 (or whichever port you're using), which may cause uploading interference.
I had the same problem, and in my case, the solution was updating the usb-serial driver using windows update on windows 10 device's manager. There was no need to download a especific driver, I just let windows update find a suitable driver.
I faced same problem. but Root cause of issue. Incorrect communication was set and thats why I occurred Communication timeout.
Solution: If you connected to laptop through USB port.
Change Port as USB. Please follow steps
Open Arduino-IDE
Go to Menu "Tools --> Port" and Select option "USB" { for me its showing as /dev/ttyUSB0 }
It working fine for me.
Something not yet mentioned is that this message also appears when the baudrate is not properly set... for Arduino, it is generally 115200.
My aurdino mega 2560 returned same error. It seems the problem exists in unofficial clones. The issue solved by pressing reset button just before uploading starts, as advertised in following video.
https://www.youtube.com/watch?v=tAzjO4v7oF4&list=LLDn5ewJDzz53IiwWmZTgQnQ&index=1

Arduino "avrdude" Error

I have been working with the Arduino system with an Arduino Uno chip for a while, but I recently came upon a problem I cannot solve. The problem is that whenever I attempt to upload a new program to my chip, I get the following error:
avrdude: stk500_getsync(): not in sync: resp=0x00
I have done some research, and I have tried everything that people have suggested. I have checked the COM port, checked the chip type, checked the component installations, updated the FTDI drivers, hit the reset button, tried the latest Arduino software, and yes, I have even made sure the board is plugged into the computer.
Earlier this year I had absolutely no problem uploading code to my board, and almost nothing has changed since I last tried it. The only thing that has changed is the cable I have used to upload the programs, and I have tried several different cables as well. Could it just be a batch of bad cables? This seems unlikely. I have also tried uploading code onto different boards, with the same result.
This is getting quite frustrating, as I really want to continue working on my projects. However, that will not happen if I cannot even print "Hello World!" to the serial monitor.
I am running on a 32-bit Windows 7 machine. Any suggestions to solving this would be greatly appreciated.
If you are expecting a normal upload using Serial then you should ensure your preferences are not set to "Upload using programmer" and that you are not selecting "Upload using programmer" from any of the Arduino menus.
EDIT
If you have not overridden the programmer then you must have the wrong board selected on the tools menu boards list. lpt1 in the error message is not what the Uno uses.
It turns out that the problem was the FTDI cable I was using. I tried a bunch of different cables until I found one that works, and now uploading occurs without any problems.
check the board you have selected in tools-> board . If you selected wrong board error comes as above. If right board being selected still getting same error , then it is definitely boot loader crashed error. You need to upload boot loader.
Sometimes parts connected to digital pin 0 and 1. The parts interfere communication between the computer and arduino so I recommend this procedure.
Check something is connected to D0 and D1.
If something is connected, unplug those.
Upload the sketch.
Plug parts removed at step 2.
your arduino maybe not uno, change board to duemilanove.

Resources