Problem in Uploading Sketch in Arduino Uno - arduino-uno

I'm using arduino for around 3-4months. Now I'm facing issue in uploading sketch in arduino Uno.
This happened after using atmel-ice for debugging. I was trying to debug the code using atmel-ice for the first time in atmel studio. I followed tutorial video on YouTube for connecting and debugging arduino uno using atmel-ice debugger. It never started debugging it turned off with an error. After that I tried to upload sketch in board using arduino ide as well as atmel studio and using ice also but it cannot upload the sketch and in atmel studio I could read the device signature previously after trying debugging, I cannot read the device signature. I never touched the fuse settings in the atmel studio for arduino. It was default.
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Saurabh\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM12
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x08
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x08
avrdude done. Thank you.
Getting above errors. in arduino ide.
I read similar issues with others some of them were saying it is in debugging mode. But after restarting it should go out of that as uno resets. I've also checked loopback it's working. This happend with my 3 of uno boards I've only 1 left now. How can I solve the issue. I tried burning boot loader also but that also got error. I think may be fuses are the issue. How can I Solve this issue.
if I'm using FTDI232 programmer it showing
avrdude: ser_open(): can't open device "\\.\COM13": Access is denied.
avrdude done. Thank you.
This Error.
After Trying using ftdi232 got
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel STK500
Programmer Model: Unknown
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
This errors.

Make sure that there is no input on the Tx/Rx pins then it works. I've tried this and board started working.

Related

Reading DS18b20 sensors using ESP-IDF using a ESP32 with a 26 MHx XTAL

I'm able to read DS18B20 sensors using the example code provided in this repository.
It works well using a standard Espressif ESP32-WROOM-32 (aka ESP32-DevKitC), which uses a 40 MHz XTAL.
I'm not able to run the same example using an Allnet-IOT-WLAN, which uses a 26 MHz XTAL.
I suspect that the problem is related with RMT initialization. The initialization is using:
rmt_tx.clk_div = 80;
I've tried different settings for clk_div with no luck.
Does anyone know how to use the DS18B20 sensor with ESP-IDF, using a board with a 26 MHz XTAL, instead of more standard 40 MHz one?
ESP32-WROOM-32 output (working)
I (0) cpu_start: Starting scheduler on APP CPU.
Find devices:
0 : d4000008e40d7428
1 : f8000008e3632528
Found 2 devices
Device 1502162ca5b2ee28 is not present
Temperature readings (degrees C): sample 1
0: 22.3 0 errors
1: 21.8 0 errors
Temperature readings (degrees C): sample 2
0: 22.3 0 errors
1: 21.9 0 errors
Allnet-IOT-WLAN output (not working)
I (0) cpu_start: Starting scheduler on APP CPU.
Find devices:
Found 0 devices
E (6780) owb_rmt: rx_items == 0
E (6880) owb_rmt: rx_items == 0
E (6980) owb_rmt: rx_items == 0
There are no differences in the RMT initialization using different XTAL clock frequencies.
D (2319) rmt: Rmt Tx Channel 1|Gpio 25|Sclk_Hz 80000000|Div 80|Carrier_Hz 0|Duty 35
D (2319) intr_alloc: Connected src 47 to int 13 (cpu 0)
D (2319) rmt: Rmt Rx Channel 0|Gpio 25|Sclk_Hz 80000000|Div 80|Thresold 77|Filter 30
Both use the same 80 MHx source.
I was using a wrong pinout diagram. I've tested the RMT with a more simple example and I found out that the pinout was wrong.
The DS18b20 sensors works well with a 26 MHz XTAL with the esp32-ds18b20 library.

ECC check for Erased pages in NAND

I wanted to verify the following patch
https://patchwork.kernel.org/patch/8368341/
For same , wrote all zero's to one of nand partition :
nandwrite -n /dev/mdt1 < /dev/zero
But now when I dump this nand partition, see following errors:
ECC: 3 uncorrectable bitflip(s) at offset 0x00000000
ECC: 2 uncorrectable bitflip(s) at offset 0x00000800
ECC: 2 uncorrectable bitflip(s) at offset 0x00001000
I thought above mentioned patch , suppose to fix this ECC errors but
it didn't.
Is they other way to verify this patch ?

Openocd how to write option bytes to STM32F4

I have two boards with a STM32F437 (IGH6 7BA4S VQ PHL 7B 542) processor. We program these with openocd and a jtag, however lately one card stopped working. It is no longer possible to program the card and one of the differences we have found is that the user option bytes differ between the cards.
0x0EC On the working card
0xCFC On the broken
What I tried to do is using the options_write command. Note that the STM32F4 apparently goes under the "stm32f2x" command.
openocd -f openocd.cfg -c "reset halt; stm32f2x unlock 0; reset halt; stm32f2x options_write 0 0x0EC"
This resulted in the error message: "Error: stm32x device protected"
In the STM32F437 Reference manual RM0090 under "3.7.2 Programming user option bytes" it says:
To run any operation on this sector, the option lock bit (OPTLOCK) in the Flash option
control register (FLASH_OPTCR) must be cleared. To be allowed to clear this bit, you have
to perform the following sequence: \n
Write OPTKEY1 = 0x0819 2A3B in the Flash option key register (FLASH_OPTKEYR)
Write OPTKEY2 = 0x4C5D 6E7F in the Flash option key register (FLASH_OPTKEYR)
The user option bytes can be protected against unwanted erase/program operations by
setting the OPTLOCK bit by software.
To do that I tried the following in a telnet session:
mww 0x08 0x08192A3B
mww 0x08 0x04C5D6E7F
mdw 0x0C
mww 0x18 0x0EC
mww 0x14 0x0EC
The 0x08 on line 1 is FLASH_OPTKEYR, 0x0C on line 3 is FLASH_SR to check if BSY bit is not set, 0x14 on line 4 is FLASH_OPTCR1, and 0x14 on line 5 is FLASH_OPTCR.
Then a reboot and trying to program the application
openocd -f openocd.cfg -c "program HCF-220_07_010_PA2.hex reset exit"
This results in the error:
Error: stm32x device protected.
I also tried to do the following command to unlock before programming:
openocd -f openocd.cfg -c "openocd -f openocd.cfg -c "reset halt; stm32f2x unlock 0; program HCF-220_07_010_PA2.hex reset exit"
Same result:
Error: stm32x device protected.
Update
I tried the following in telnet without luck, the user option is still 0xCFC:
mww 0x40023C08 0x08192A3B
mww 0x40023C08 0x04C5D6E7F
mdw 0x40023c0c
mww 0x40023C18 0x0EC
mww 0x40023C14 0x0EC
mww 0x40023C08 0x02
Power Cycle
In RM0090 chapter 3.7.2 it also says: 4. Set the option start bit (OPTSTRT) in the FLASH_OPTCR register
Hence the nr 6. above.
The working solution for me was as follows:
stm32f2x lock 0 Yes lock not unlock.
Do a power cycle
reset init
mww 0x40023C08 0x08192A3B
mww 0x40023C08 0x04C5D6E7F
mdw 0x40023c0c Wait for flash write to finish, make sure we receive 00000000
mww 0x40023C18 0x0FFF0000
mww 0x40023C14 0x0FFFAAEC Write user_options to same as a working
mww 0x40023C14 0x0FFFAAEE Set option start bit, step "4." in rm0090.
mdw 0x40023c0c Wait for flash erase to finish, make sure we receive 00000. This takes about 10 seconds.
Do a power cycle
The reason why it did not work with OpenOCD command "options_write", can be found in the manual for OpenOCD. The "user_options" argument takes the bits 31-28 and 7-0 from FLASH_OPTCR.
Flash register base address is 0x40023C00 (as per RM0090). 0x08 is offset from base, so you should write to 0x40023C08

avrdude and attiny2313 and avrisp

I'm trying to program my ATTiny 2313 with avrdude. This is my command line and output (The first line is the command I entered, the others are the output):
utnmac:firmware utn$ make flash
avrdude -c avrispmkII -p attiny2313 -U flash:w:main.hex:i
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffffff (retrying)
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffffff (retrying)
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
make: *** [flash] Error 1
UPDATE: Seems to be a problem with my wiring but i can't find a good tutorial on where my wiring needs to go. Right now I'm using this:
Is that the entirety of your circuit?
From the online documentation,
The AVRISP mkII does not provide power on the Vcc pin, but uses this pin to sense the voltage on the target circuitry. Your circuit needs to be powered by external means to operate.
You also need to pull reset to Vcc through a resistor so that it doesn't float when not activated.

atmega8 program size limit?

I am new to atmega8. I convert some old freesacle code into atmega8. but seems my chip can not hold code more than 2400 bytes? below is result, when code is 2412 bytes... all things become mess.
code below avrdude is comes from "cat /dev/ttyUSB0". my debug informations.
avrdude: verifying ...
avrdude: 2412 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
55432111001-0000 6Gn�H(�h�X0443234554321190 6Gn�H (�h�X0443234554321100-FD-90-6F55432111001-0000 6Gn�H (�h�X0443234554321190 6Gn�H(�h�X0443234554321100-FD-90-6F^C
but if i reduced code(only audio data), i got right result.
avrdude: verifying ...
avrdude: 2312 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
AVR-IrDA-Tone-Audio start.
version 1.2
--IrDA-- Bin: 1001-0000 Hex: 90 Complete Hex: 00-FD-90-6F
all hfuse, lfuse, lock bits are original value. my code might be 6k with some audio data.
if it is due to boot flash section?
Addtion: --------------------------------------------------------------------------------------------------
I change crystal to 8M now.
● ll h8-*
-rw-rw-r-- 1 eexp eexp 933 9月 22 00:27 h8-reduce.c
-rw-rw-r-- 1 eexp eexp 14K 9月 22 00:26 h8-org.c
● cp h8-org.c h8.c
● avr.sh main.c
......
avrdude: 5272 bytes of flash verified
now all goes mess.
● cp h8-reduce.c h8.c
● avr.sh main.c
.....
avrdude: 1872 bytes of flash verified
now all goes right, but i lost almost all audio data.
below is h8.c.
● head h8.c
const unsigned char h8[] =
{
36,14,0,0,129,129,128,129,130,127,126,128,128,127,128,130,131,128,127,127,127,126,127,129,130,130,129,129,128,128,128,128,128,126,126,129,128,127,127,130,133,130,126,126,129,128,125,127,128,129,128,127,129,128,127,127,127,128,128,129,127,127,129,128,130,130,128,128,127,126,128,128,128,130,129,128,129,126,126,125,127,132,130,127,126,129,131,127,127,133,133,127,122,125,129,130,127,127,130,129,
126,125,127,128,129,128,128,128,128,127,127,129,128,129,129,128,126,127,129,127,128,127,128,130,129,129,128,128,127,127,129,130,128,128,129,129,127,127,128,128,128,128,128,128,126,126,129,129,127,129,130,130,126,126,128,128,127,128,131,130,127,126,126,128,129,125,128,130,131,128,126,129,128,129,125,126,130,129,131,130,131,129,125,128,129,131,130,127,130,129,127,128,127,129,128,126,126,127,128,126,
127,127,128,128,128,127,127,127,127,127,129,128,129,128,128,129,129,128,128,129,128,128,128,129,0xff,
};
i guess you are loading the audio data into the ram. a variable declaration like
char* data = "somerandomdata";
is putting all the data in the SRAM, and you just have 1kbyte of SRAM in the mega8 (which also contains the stack etc).
if the lock bits are in their original state, the bootloader mechanism should not cause this error.
you should specify the audio data as program space, here is the description how:
Avr LibC PGM Space
here is how your code should look like:
h4.c
#include <avr/pgmspace.h>
const unsigned char h4[] PROGMEM = { 18,7,0,0,128,128,128,127,127,129,129,127,126,128,130,129,128,129,127,127,128,12‌​8,132,127,129,126,128,128,127,127,127,129,127,127,130,129,127,127,129,130,129,125‌​,
you need to adjust your set_audio function,
every reading of the pointer h4 shall be done in this way:
change for example
value = *h4_copy++;
to
value = pgm_read_byte(h4_copy); h4_copy++;

Resources