ATMega328p AVRDude RC=-1 with USBTinyISP - avr

I now tried the 8th time to program my ATMega328p with the USBTinyISP from ADAFRUIT. AVRDude still returns this error:
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : lpt1
Using Programmer : usbtiny
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 5 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 : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported
avrdude: Using SCK period of 10 usec
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
To double check I did:
Use the USBTinyISP with my arduino UNO and connected it to the board, tested with avrdude and could connect successfully. So the connector is fine.
I do not know where to search anymore.

Related

SNMP hrStorageIndex may changed sometimes. How to identify a disk in SNMP?

hrStorageIndex and ifIndex may changed after reboot sometimes.
How to identify a specific disk and network interface in SNMP, both under Linux and windows?
There are columns for hrStorageDescr and hrStorageType in the HOST-RESOURCES-MIB::hrStorageTable table.
Here is an example ...
snmptable -M +. -m +ALL -v 2c -Ci -c public -Pu myhost HOST-RESOURCES-MIB::hrStorageTable
SNMP table: HOST-RESOURCES-MIB::hrStorageTable
index hrStorageIndex hrStorageType hrStorageDescr hrStorageAllocationUnits hrStorageSize hrStorageUsed hrStorageAllocationFailures
1 1 HOST-RESOURCES-TYPES::hrStorageRam Physical memory 1024 Bytes 8057980 7268792 ?
3 3 HOST-RESOURCES-TYPES::hrStorageVirtualMemory Virtual memory 1024 Bytes 18347124 7687064 ?
6 6 HOST-RESOURCES-TYPES::hrStorageOther Memory buffers 1024 Bytes 8057980 124288 ?
7 7 HOST-RESOURCES-TYPES::hrStorageOther Cached memory 1024 Bytes 2366160 2366160 ?
10 10 HOST-RESOURCES-TYPES::hrStorageVirtualMemory Swap space 1024 Bytes 10289144 418272 ?
31 31 HOST-RESOURCES-TYPES::hrStorageFixedDisk / 4096 Bytes 12901535 11461911 ?
35 35 HOST-RESOURCES-TYPES::hrStorageFixedDisk /dev/shm 4096 Bytes 1007247 0 ?
36 36 HOST-RESOURCES-TYPES::hrStorageFixedDisk /boot 1024 Bytes 495844 100151 ?
37 37 HOST-RESOURCES-TYPES::hrStorageFixedDisk /home 4096 Bytes 44531330 5981531 ?
Same principle for IF-MIB::ifTable which has a ifDescr column ...
snmptable -M +. -m +ALL -v 2c -Ci -c public -Pu myhost IF-MIB::ifTable
SNMP table: IF-MIB::ifTable
index ifIndex ifDescr ifType ifMtu ifSpeed ifPhysAddress ifAdminStatus ifOperStatus ifLastChange ifInOctets ifInUcastPkts ifInNUcastPkts ifInDiscards ifInErrors ifInUnknownProtos ifOutOctets ifOutUcastPkts ifOutNUcastPkts ifOutDiscards ifOutErrors ifOutQLen ifSpecific
1 1 lo softwareLoopback 16436 10000000 up up 0:0:00:00.00 723382401 729363414 0 0 0 0 723382401 729363414 0 0 0 0 SNMPv2-SMI::zeroDotZero
2 2 eth0 ethernetCsmacd 1500 1000000000 0:21:5e:4d:15:b7 up up 0:0:00:00.00 1030103587 37542077 3449194 0 0 0 1570760541 32130390 0 0 0 0 SNMPv2-SMI::zeroDotZero
3 3 eth1 ethernetCsmacd 1500 0 0:21:5e:4d:15:b8 down down 0:0:00:00.00 0 0 0 0 0 0 0 0 0 0 0 0 SNMPv2-SMI::zeroDotZero

How are floppy disk sectors numbered

I was wondering how are floppy disk sectors ordered, I am currently writing a program to access the root directory of a floppy disk (fat12 formated High Density), I can load it with debug at sector 13h but in assembly it is at head 1 track 0 sector 2 why is sector 13h, not at head 0 track 1 sector 1?
That's because the sectors on the other side of the disk comes before the sectors on the second track on the first side.
Sectors 0 through 17 (11h) are found at head 0 track 0. Sectors 18 (12h) through 35 (23h) are found at head 1 track 0.
Logical sectors are numbered from zero up, but the sectors in a track are numbered from 1 to 18 (12h).
sector# head track sector usage
------- ---- ----- ------ --------
0 0h 0 0 1 1h boot
1 1h 0 0 2 2h FAT 1
2 2h 0 0 3 3h |
3 3h 0 0 4 4h v
4 4h 0 0 5 5h
5 5h 0 0 6 6h
6 6h 0 0 7 7h
7 7h 0 0 8 8h
8 8h 0 0 9 9h
9 9h 0 0 10 ah
10 ah 0 0 11 bh FAT 2
11 bh 0 0 12 ch |
12 ch 0 0 13 dh v
13 dh 0 0 14 eh
14 eh 0 0 15 fh
15 fh 0 0 16 10h
16 10h 0 0 17 11h
17 11h 0 0 18 12h
18 12h 1 0 1 1h
19 13h 1 0 2 2h root
20 14h 1 0 3 3h |
21 15h 1 0 4 4h v
...

Crash While running Pushgp using SBCL 1.1.6.0-3c5581a on mac OS X Yosemite Ver. 10.10.3

The following error message occured While running Pushgp using SBCL 1.1.6.0-3c5581a on mac OS X Yosemite Ver. 10.10.3, what do i do next to correct it and avoid future occurrence? Thanks
Producing next generation...
Heap exhausted during garbage collection: 48 bytes available, 80 requested.
Gen StaPg UbSta LaSta LUbSt Boxed Unboxed LB LUB !move Alloc Waste Trig WP GCs Mem-age
0: 0 0 0 0 0 0 0 0 0 0 0 5368709 0 0 0.0000
1: 0 0 0 0 0 0 0 0 0 0 0 5368709 0 0 0.0000
2: 0 0 0 0 0 0 0 0 0 0 0 5368709 0 0 0.0000
3: 0 0 0 0 0 0 0 0 0 0 0 5368709 0 0 0.0000
4: 90540 90458 0 0 16653 42019 3720 930 0 257732888 1634024 2000000 0 0 1.0370
5: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
6: 0 0 0 0 5615 1269 0 0 0 28196864 0 2000000 5549 0 0.0000
Total bytes allocated = 533559232
Dynamic-space-size bytes = 536870912
GC control variables:
*GC-INHIBIT* = true
*GC-PENDING* = in progress
fatal error encountered in SBCL pid 776:
Heap exhausted, game over.
Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb>
Assuming your running out of memory is not caused by a larger problem, you might just be able to run sbcl with a larger dynamic space size, e.g.
sbcl --dynamic-space-size 2048

Writing to Mifare Ultralight C with PN532 library for Arduino Uno

I use the sample code to read from MIFARE Ultralight and write to MIFARE Classic, with the definition in .h file:
#define PN532_RESPONSE_INDATAEXCHANGE (0x41)
#define MIFARE_CMD_WRITE (0xA0)
but when I run the code below:
/**************************************************************************/
uint8_t PN532::mifareultralight_WritePage (uint8_t page, uint8_t *buffer1)
{
/* Prepare the first command */
pn532_packetbuffer[0] = PN532_COMMAND_INDATAEXCHANGE;
pn532_packetbuffer[1] = 1; /* Card number */
pn532_packetbuffer[2] = MIFARE_CMD_WRITE; /* Mifare Write command = 0xA0 */
pn532_packetbuffer[3] = page; /* Page Number (0..63 in most cases) */
memcpy (pn532_packetbuffer + 4, buffer1, 4); /* Data Payload */
/* Send the command */
if (HAL(writeCommand)(pn532_packetbuffer, 8)) {
Serial.println(F("Go here 1"));
return 0;
}
Serial.println(F("Go here 2"));
/* Read the response packet */
return (0 < HAL(readResponse)(pn532_packetbuffer, sizeof(pn532_packetbuffer)));
}
The result would be like this:
Scan a NFC tag
write: 4A 1 0
read: 4B 1 1 0 44 0 7 4 C1 37 CA 2C 2C 80
ATQA: 0x 44SAK: 0x 0
Writing Mifare Ultralight
write: 40 1 30 4
read: 41 0 2 0 0 10 0 6 1 10 11 FF 0 0 0 0 0 0
write: 40 1 30 3
read: 41 0 0 0 0 0 2 0 0 10 0 6 1 10 11 FF 0 0
Tag capacity 0 bytes
write: 40 1 A0 5 1 2 3 4
Go here 2
Write failed 0
It does not go into "Go here 1", it means that no write command to the reader, do anyone know why?
That write command you are using seems to be wrong. You are using the COMPATIBILITY_WRITE command code (0xA0) but you pass the parameters of a WRITE command.
I suggest you stick to the WRITE command:
+-----------+------+------+---------------------+
| WRAPPING | CMD | ADDR | DATA (1 PAGE) |
+-----------+------+------+---------------------+
| 0x40 0x01 | 0xA2 | 0x05 | 0x01 0x02 0x03 0x04 |
+-----------+------+------+---------------------+
Or you could also use the COMPATIBILITY_WRITE command:
You start with sending the command and the address:
+-----------+------+------+
| WRAPPING | CMD | ADDR |
+-----------+------+------+
| 0x40 0x01 | 0xA0 | 0x05 |
+-----------+------+------+
You should then receive the ACK/NAK status from the tag.
Then you send the data in a second frame:
+-----------+---------------------+------------------------------------------------------------+
| WRAPPING | DATA (1 PAGE) | FILLER (3 EMPTY PAGES)
+-----------+---------------------+------------------------------------------------------------+
| 0x40 0x01 | 0x01 0x02 0x03 0x04 | 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+-----------+---------------------+------------------------------------------------------------+

Calculating CPU usage from /proc/stat

When reading /proc/stat, I get these return values:
cpu 20582190 643 1606363 658948861 509691 24 112555 0 0 0
cpu0 3408982 106 264219 81480207 19354 0 35 0 0 0
cpu1 3395441 116 265930 81509149 11129 0 30 0 0 0
cpu2 3411003 197 214515 81133228 418090 0 1911 0 0 0
cpu3 3478358 168 257604 81417703 30421 0 29 0 0 0
cpu4 1840706 20 155376 83328751 1564 0 7 0 0 0
cpu5 1416488 15 171101 83410586 1645 13 108729 0 0 0
cpu6 1773002 7 133686 83346305 25666 10 1803 0 0 0
cpu7 1858207 10 143928 83322929 1819 0 8 0 0 0
Some sources state to read only the first four values to calculate CPU usage, while some sources say to read all the values.
Do I read only the first four values to calculate CPU utilization; the values user, nice, system, and idle? Or do I need all the values? Or not all, but more than four? Would I need iowait, irq, or softirq?
cpu 20582190 643 1606363
Versus the entire line.
cpu 20582190 643 1606363 658948861 509691 24 112555 0 0 0
Edits: Some sources also state that iowait is added into idle.
When calculating a specific process' CPU usage, does the method differ?
The man page states that it varies with architecture, and also gives a couple of examples describing how they are different:
In Linux 2.6 this line includes three additional columns: ...
Since Linux 2.6.11, there is an eighth column, ...
Since Linux 2.6.24, there is a ninth column, ...
When "some people said to only use..." they were probably not taking these into account.
Regarding whether the calculation differs across CPUs: You will find lines related to "cpu", "cpu0", "cpu1", ... in /proc/stat. The "cpu" fields are all aggregates (not averages) of corresponding fields for the individual CPUs. You can check that for yourself with a simple awk one-liner.
cpu 84282 747 20805 1615949 44349 0 308 0 0 0
cpu0 26754 343 9611 375347 27092 0 301 0 0 0
cpu1 12707 56 2581 422198 5036 0 1 0 0 0
cpu2 33356 173 6160 394561 7508 0 4 0 0 0
cpu3 11464 174 2452 423841 4712 0 1 0 0 0

Resources