Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

1.0.0-RC3 at rev 1148 Arduino UNO some HEX doesn't work

3 posters

Go down  Message [Page 1 of 1]

leonidv



What I do:
1. Create new project
2. Add Arduino UNO
3. Load hex which just blinking 13 led

What I expect - led on arduino is blinking.

What I see - nothing.

Code:
Loading hex file:
 "/home/leonidv/Documents/programming/arduino/amperka/01_blink/target/avr-atmega328p/release/blink.hex"
Firmware succesfully loaded


Starting Circuit Simulation...

  Created       28    eNodes 104 Pins
  Initializing  68    eElements
  Initializing  28    eNodes

  Initializing Matrix:  28  eNodes

Circuit Matrix looks good

FPS:   20    Frames per Sec
Speed: 100 %
Speed: 1000000000000    ps per Sec
ps/Fr: 50000000000    ps per Frame
NonLi: 100000    Max Iterations

    Simulation Running...

CircMatrix::solveMatrix 1 Circuits
CircMatrix::solveMatrix 26 Single Nodes


    Simulation Stopped

I have checked in stable version (0.4.15-SR10) and it works as expected.



Last edited by arcachofo on Mon Oct 17, 2022 7:06 am; edited 1 time in total (Reason for editing : Mark as solved (green color))

arcachofo

arcachofo

Hi.

It is working for me with hex files generated by Avrgcc.
Maybe is something about your compiler, can you share that hex file here? (just copy the content and paste here is ok).

leonidv



Hi,

Sorry, I thought that I have attached hex file.

Please, take attention - both hex files correctly works in stable version (0.4.15-SR10).

this is blink.txt doesn't work on 1.0.0-RC3
Code:
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0E4E4F1E002C0FA
:1000800005900D92A030B107D9F721E0A0E0B1E0D2
:1000900001C01D92A130B207E1F70E9453000C94F9
:1000A000A0000C9400000E9457000E949B00EF9259
:1000B000FF921F938FB7F89490910001903011F048
:1000C00090E003C091E09093000188230AF47894B3
:1000D000903009F423C02D98259A60E070E027EF56
:1000E0003FE343EF50E08BEF98E07C011D9AFB016A
:1000F000DB01C9010197F1F711E0E417F507A60745
:10010000B70708F010E01170EF5FFF4FAF4FBF4F20
:10011000103079F7C7010197F1F7E8CF0E949200FC
:100120000E949B000E9496000E949B000E949A00E1
:100130000E949B00FFCF81E090E0F8940C94A00017
:04014000F894FFCF61
:00000001FF

this blink-fade.hex works in 1.0.0-RC3
Code:

:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0EEECF1E002C0E8
:1000800005900D92A030B107D9F721E0A0E0B1E0D2
:1000900001C01D92A130B207E1F70E9453000C94F9
:1000A000E5000C9400000E9457000E94E000CF92EF
:1000B000DF92EF92FF920F931F939FB7F894809176
:1000C0000001803019F421E02093000199230AF403
:1000D0007894803009F067C02998219A81E880934C
:1000E00080008BE08093810088E290E07C0180E0DA
:1000F00090E047EF5FE36BE372E028E730E06901EF
:10010000AFEFB0E0970130938900209388008C0115
:100110009C01FA013197F1F7E1E00C331105280752
:10012000390708F0E12DE1700F5F1F4F2F4F3F4F50
:10013000E03079F7FB013197F1F7960130938900B0
:10014000209388008C019C01FA013197F1F7E1E0DE
:100150000C3311052807390708F0E12DE1700F5F16
:100160001F4F2F4F3F4FE03079F7FB013197F1F7E9
:10017000B0938900A09388008C019C01FA0131970B
:10018000F1F7E1E00C3311052807390708F0E12DFC
:10019000E1700F5F1F4F2F4F3F4FE03079F7FB01AA
:1001A0003197F1F7AFCF0E94DB000E94E0000E9480
:1001B000DF000E94E0000E94D7000E94E000FFCF15
:0E01C00081E090E0F8940C94E500F894FFCFF5
:00000001FF

blink-fade.sim1
Code:

<circuit type="simulide_1.0" rev="1007" stepSize="1000000" stepsPS="500000" NLsteps="100000" animate="0" >

<item itemtype="Subcircuit" CircId="Uno-2" mainComp="false" Show_id="true" Show_Val="false" Pos="400,444" rotation="360" hflip="1" vflip="1" label="Uno-2" idLabPos="0,-20" labelrot="0" valLabPos="-16,20" valLabRot="0" Logic_Symbol="false">
<mainCompProps itemtype="MCU" CircId="2_mega328-109" mainComp="true" Show_id="false" Show_Val="false" Pos="20,20" rotation="0" hflip="1" vflip="1" label="2_mega328-109" idLabPos="0,-20" labelrot="0" valLabPos="-16,20" valLabRot="0" Frequency="16 MHz" Program="target/avr-atmega328p/release/blink-fade.hex" Auto_Load="false" Rst_enabled="true" Ext_Osc="true" Wdt_enabled="false" />
</item>

<item itemtype="Resistor" CircId="Resistor-5" mainComp="false" ShowProp="Resistance" Show_id="false" Show_Val="true" Pos="628,464" rotation="0" hflip="1" vflip="1" label="Resistor-5" idLabPos="-16,-24" labelrot="0" valLabPos="-16,6" valLabRot="0" Resistance="220 Ω" />

<item itemtype="Led" CircId="Led-7" mainComp="false" Show_id="false" Show_Val="false" Pos="668,492" rotation="90" hflip="1" vflip="1" label="Led-7" idLabPos="-16,-24" labelrot="0" valLabPos="-16,20" valLabRot="0" Color="Yellow" Grounded="false" Threshold="2.4 V" MaxCurrent="10 mA" Resistance="0.6 Ω" />

<item itemtype="Oscope" CircId="Oscope-10" mainComp="false" ShowProp="Basic_X" Show_id="false" Show_Val="true" Pos="788,460" rotation="0" hflip="1" vflip="1" label="Oscope-10" idLabPos="-90,-100" labelrot="0" valLabPos="-16,20" valLabRot="0" Basic_X="200 Pixels" Basic_Y="135 Pixels" TimDiv="250000000" TimPos="221971208,0,0,0," VolDiv="1,1,1,1," Tunnels=",,,," Trigger="0" Filter="0.1 V" Trigger="0" AutoSC="4" Tracks="1" HideCh="false,true,true,true," VolPos="-1.63,-1.63,-1.63,-1.63," />

<item itemtype="Node" CircId="Node-11" mainComp="false" Pos="580,412" />

<item itemtype="Node" CircId="Node-23" mainComp="false" Pos="700,524" />

<item itemtype="Connector" uid="connector-24" startpinid="Uno-2-9" endpinid="Node-11-0" pointList="408,540,380,540,380,412,580,412" />

<item itemtype="Connector" uid="connector-25" startpinid="Node-11-2" endpinid="Resistor-5-lPin" pointList="580,412,580,464,612,464" />

<item itemtype="Connector" uid="connector-26" startpinid="Node-11-1" endpinid="Oscope-10-Pin0" pointList="580,412,700,412" />

<item itemtype="Connector" uid="connector-27" startpinid="Node-23-2" endpinid="Uno-2-GND0" pointList="700,524,552,524" />

<item itemtype="Connector" uid="connector-28" startpinid="Led-7-rPin" endpinid="Node-23-0" pointList="668,508,668,524,700,524" />

<item itemtype="Connector" uid="connector-29" startpinid="Node-23-1" endpinid="Oscope-10-PinG" pointList="700,524,700,524" />

<item itemtype="Connector" uid="connector-30" startpinid="Resistor-5-rPin" endpinid="Led-7-lPin" pointList="644,464,668,464,668,476" />

</circuit>

As far as I can  tell, elf file build using avr-gcc. I use avrobj to convert elf to hex:

Code:

avr-objcopy -j .text -j .data -O ihex $ELF $HEX

arcachofo

arcachofo

Thanks for the files, I could do some basic tests.

The problem seems to be that writing 1 to PINB bit should toggle PORTB bit, but this is not working.
I will get into this as soon as I can.

Please, take attention - both hex files correctly works in stable version (0.4.15-SR10).
In this case this is not relevant: 1.0.0 uses a completely new MCU simulator, including .hex loader.

Thanks for reporting.

leonidv likes this post

arcachofo

arcachofo

Solved at trunk Rev 1359.

KerimF



arcachofo wrote:The problem seems to be that writing 1 to PINB bit should toggle PORTB bit, but this is not working.

Please note that from datasheet of ATmega8:
PINx. The Port Input Pins I/O location is read only

arcachofo

arcachofo

Please note that from datasheet of ATmega8:
PINx. The Port Input Pins I/O location is read only
Yes but in ATmega328 writing to PINx toggles PORTx bits.

KerimF



arcachofo wrote:
Please note that from datasheet of ATmega8:
PINx. The Port Input Pins I/O location is read only
Yes but in ATmega328 writing to PINx toggles PORTx bits.

Thank you for this remark.

I missed this info because I don't use ATmega328 so I didn't read its datasheet attentively as I did for ATmega8 (or of any IC I may use in my designs).

I have to be more careful when commenting about something that I don't use, even if it is said being of the same family of what I am familiar to.

arcachofo

arcachofo

I have to be more careful when commenting about something that I don't use, even if it is said being of the same family of what I am familiar to.
I think it is always better to comment too much, making errors is the best way to improve.
In addition sometimes it can bring some insight, for example I realized that my implementation at Rev 1359 had an error: It indeed overwrites PINx register for a brief moment, which can create some glitches (solved at trunk Rev 1363)
.



Last edited by arcachofo on Sat Oct 22, 2022 11:22 am; edited 1 time in total (Reason for editing : add info.)

leonidv



Hi! I have checked SimulIDE trunk at Rev 1365. Simple blink is really works, thanks!

Here are example which are still not working in Simulide (and works at hardware):

It uses timer1 in CTC mode and changing pin 9 (by MCU)
Code:

:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0E0E5F2E002C0FC
:1000800005900D92AC32B107D9F721E0ACE2B1E0B6
:1000900001C01D92AD32B207E1F70E9454000C94EA
:1000A00026010C940000FFCF0E9458000E942101FD
:1000B0004F925F926F927F928F929F92AF92BF9278
:1000C000CF92DF92EF92FF920F931F939FB7F89416
:1000D00080912C01803019F421E020932C01992388
:1000E0000AF47894803009F02CC02998219A83E38F
:1000F00096E67C0186EB92E76C0183EC90E85C016C
:100100008BE698E84C0180E299E93C0180EE9BEA9D
:100110002C010CEE10ECC7010E94A900C6010E9440
:10012000A900C5010E94A900C4010E94A900C30141
:100130000E94A900C2010E94A900C8010E94A90052
:10014000EACF80E091E06BE270E00E94FB000E9449
:1001500021010F931F939C0100E010E01093850094
:100160000093840080E48093800088E08093810085
:1001700060E072EC8BEE9BE0A8010E94FF00CA01D8
:1001800036952795982F9295907F8827990F990FEC
:10019000990F822B932B019790938900809388006D
:1001A00080918100887F82608093810087EF9FE348
:1001B0009801A801FC013197F1F761E0233F310577
:1001C0004007510708F0612D61702F5F3F4F4F4F7F
:1001D0005F4F603079F78BEF98E00197F1F78091EE
:1001E0008100887F809381001F910F9108950E9464
:1001F00053000E9421010E94F7000E942101A1E208
:100200001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F90
:10021000FF1FA217B307E407F50720F0A21BB30BDB
:10022000E40BF50B661F771F881F991F1A9469F757
:1002300060957095809590959B01AC01BD01CF01B3
:10024000089581E090E0F8940C942601F894FFCF93
:1002500063616C6C656420604F7074696F6E3A3ACC
:10026000756E77726170282960206F6E2061206042
:0C0270004E6F6E65602076616C75650055
:00000001FF

Simulide project:

Code:

<circuit version="trunk" rev="1365" stepSize="1000000" stepsPS="1000000" NLsteps="100000" reaStep="1000000" animate="0" >

<item itemtype="AudioOut" CircId="AudioOut-8" mainComp="false" Show_id="false" Show_Val="false" Pos="84,340" rotation="0" hflip="1" vflip="1" label="AudioOut-8" idLabPos="-20,-36" labelrot="0" valLabPos="-16,20" valLabRot="0" Buzzer="false" Impedance="8 Ω" />

<item itemtype="Subcircuit" CircId="Uno-9" mainComp="false" Show_id="true" Show_Val="false" Pos="-112,252" rotation="0" hflip="1" vflip="1" label="Uno-9" idLabPos="0,-20" labelrot="0" valLabPos="-16,20" valLabRot="0" Logic_Symbol="false">
<mainCompProps itemtype="MCU" CircId="9_mega328-109" mainComp="true" Show_id="false" Show_Val="false" Pos="20,20" rotation="0" hflip="1" vflip="1" label="9_mega328-109" idLabPos="0,-20" labelrot="0" valLabPos="-16,20" valLabRot="0" Frequency="16 MHz" Program="../target/avr-atmega328p/debug/04_buzzer.hex" Auto_Load="false" Rst_enabled="true" Ext_Osc="true" Wdt_enabled="false" SerialMon="-1" />
</item>

<item itemtype="FreqMeter" CircId="FreqMeter-24" mainComp="false" Show_id="false" Show_Val="false" Pos="124,280" rotation="0" hflip="1" vflip="1" label="FreqMeter-24" idLabPos="-32,-24" labelrot="0" valLabPos="-16,20" valLabRot="0" Filter="0.1 V" />

<item itemtype="Node" CircId="Node-26" mainComp="false" Pos="68,280" />

<item itemtype="Connector" uid="connector-28" startpinid="Uno-9-9" endpinid="Node-26-0" pointList="-104,348,-136,348,-136,228,68,228,68,280" />

<item itemtype="Connector" uid="connector-29" startpinid="FreqMeter-24-lPin" endpinid="Node-26-1" pointList="84,280,68,280" />

<item itemtype="Connector" uid="connector-30" startpinid="Node-26-2" endpinid="AudioOut-8-lPin" pointList="68,280,68,332" />

<item itemtype="Connector" uid="Connector-37" startpinid="AudioOut-8-rPin" endpinid="Uno-9-GND2" pointList="68,340,68,484,-116,484,-116,388,-104,388" />

</circuit>

arcachofo

arcachofo

One problem is that an Arduino pin can't properly drive an 8 Ohm load.
Increase the impedance of the AudioOut component and it will work.

But there is a bug that prevents OcUnit Pin toggle in this case, solved at trunk Rev 1375 (1.0.0 Rev 1156.).

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum