Shop OBEX P1 Docs P2 Docs Learn Events
Bug fix for reset problem - Page 2 — Parallax Forums

Bug fix for reset problem

2»

Comments

  • KyeKye Posts: 2,200
    edited 2014-08-11 15:22
    Set the number of spaces per tab.
  • cgraceycgracey Posts: 14,155
    edited 2014-08-11 15:28
    Kye wrote: »
    Set the number of spaces per tab.

    If you go to:

    Tools | Options | Text Editor

    You can check a box that will insert spaces instead of a tab character when you hit the tab key, but that doesn't affect the existing text in your file.

    Is there some other way?
  • jmgjmg Posts: 15,173
    edited 2014-08-11 15:49
    cgracey wrote: »
    Is there some other way?

    In Notepad++, I see under Edit.BlankOperations, there are two 'live' choices of Tab-to-Space and Space-toTab
  • cgraceycgracey Posts: 14,155
    edited 2014-08-11 15:55
    About the reset problem: Is anyone still having any issues?

    About the tab situation: I don't know what I'll do about this, yet. Personally, I kind of like tabs, because no matter what you type with tabs, you go to easily-identifiable offsets. Spaced indentions get smeared all over the place when I edit code, and that frustrates me, as I'm a little OCD about things lining up.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-08-11 16:03
    cgracey wrote: »
    About the reset problem: Is anyone still having any issues?

    About the tab situation: I don't know what I'll do about this, yet. Personally, I kind of like tabs, because no matter what you type with tabs, you go to easily-identifiable offsets. Spaced indentions get smeared all over the place when I edit code, and that frustrates me, as I'm a little OCD about things lining up.

    I have the patch from the TP but I notice I have a EEPROM attached on the DE0 and it doesn't like a reboot, I have to F10 it each time. Did I miss something.

    BTW, I haven't had that much time to spend on this and learn Verilog on the go but I'm hoping to spend more time this week doing so, just as well! So a quick question which I should really ask on a new thread but where in the code is the bit that "rotates the propeller" to select the next cog? I can see all the bus and bus latches but maybe my eyes are playing tricks on me.

    BTWA, Thanks heaps and heaps again and again.
  • cgraceycgracey Posts: 14,155
    edited 2014-08-11 16:10
    I have the patch from the TP but I notice I have a EEPROM attached on the DE0 and it doesn't like a reboot, I have to F10 it each time. Did I miss something.

    BTW, I haven't had that much time to spend on this and learn Verilog on the go but I'm hoping to spend more time this week doing so, just as well! So a quick question which I should really ask on a new thread but where in the code is the bit that "rotates the propeller" to select the next cog? I can see all the bus and bus latches but maybe my eyes are playing tricks on me.

    BTWA, Thanks heaps and heaps again and again.

    Do you have a pull-up resistor on SDA?


    In dig.v there's this section:
    // bus select
    
    reg [7:0] bus_sel;
    
    always @(posedge clk_cog or negedge nres)
    if (!nres)
    	bus_sel <= 8'b0;
    else if (ena_bus)
    	bus_sel <= {bus_sel[6:0], ~|bus_sel[6:0]};
    


    That bus_sel group of 8 signals is the hub rotator. They're all 0 on reset, but then a single '1' starts rotating from bit0 to bit7, and back to bit0 again, round and round. That's what determines which cog has access to the hub.
  • jmgjmg Posts: 15,173
    edited 2014-08-11 16:13
    cgracey wrote: »
    About the tab situation: I don't know what I'll do about this, yet. Personally, I kind of like tabs, because no matter what you type with tabs, you go to easily-identifiable offsets. Spaced indentions get smeared all over the place when I edit code, and that frustrates me, as I'm a little OCD about things lining up.

    The notepad++ feature I mentioned works both ways, so you can still restore any file to TABS, and work like that, then publish with TABS to spaces. ( Or anyone who does not like TABS can do this themselves. )
  • cgraceycgracey Posts: 14,155
    edited 2014-08-11 16:16
    jmg wrote: »
    The notepad++ feature I mentioned works both ways, so you can still restore any file to TABS, and work like that, then publish with TABS to spaces. ( Or anyone who does not like TABS can do this themselves. )

    Okay. I'll try this out:

    http://notepad-plus-plus.org/download/v6.6.8.html

    Thanks, jmg.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-08-11 16:16
    cgracey wrote: »
    Do you have a pull-up resistor on SDA?


    In dig.v there's this section:
    // bus select
    
    reg [7:0] bus_sel;
    
    always @(posedge clk_cog or negedge nres)
    if (!nres)
        bus_sel <= 8'b0;
    else if (ena_bus)
        bus_sel <= {bus_sel[6:0], ~|bus_sel[6:0]};
    


    That bus_sel group of 8 signals is the hub rotator. They're all 0 on reset, but then a single '1' starts rotating from bit0 to bit7, and back to bit0 again, round and round. That's what determines which cog has access to the hub.

    Yes, I have the pullup but I will double check anyway. Since I didn't really have any DIP the EEPROM is actually on another board where I have the Prop hardwired into reset. Works normally once booted and I can read other I2C devices easily.

    I have been commenting source and did notice the hub in dig.v but I think I missed the import of the other part :)
    genvar i; 
    generate 
        for (i=0; i<8; i++) 
    etc
    

    Thanks.
  • ozpropdevozpropdev Posts: 2,792
    edited 2014-08-11 18:59
    cgracey wrote: »
    About the reset problem: Is anyone still having any issues?
    Chip, I have a DE0 with EEPROM and your fix.
    Reset/Boot/Program all work fine! :):)
    Haven't tried it on my DE2 yet.
    Cheers
    Brian
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-08-11 19:03
    Chip,
    I am surprised Quartus only replaces tabs with a single space. What a PITA.
    Anyway, don't waste too much time with this. We can do this for you.. heater can you do it again?
  • Heater.Heater. Posts: 21,230
    edited 2014-08-12 00:30
    Having tabs in the source is a real no-no.

    Yes some editors can sort this out for you and display the thing correctly. Not all do. It also goes wrong in other circumstances, for example when browsing the code on the pages of GitHub. Or try cutting and pasting a snippet of that source into a post on this forum, it will be screwed.

    Worst of all if you have contributors not following the "no tabs rule" you will end up with source that contains spaces and tabs all mixed up. You will get people "fixing" that formatting when they see it. This all makes viewing diffs between different versions much harder as all those non-functional space changes will show up in the diffs.

    Just say no to tabs. I beg you...on my knees here...
    We can do this for you.. heater can you do it again?
    I could but I won't. The tab free source is posted in github here : https://github.com/ZiCog/P8X32A_Emulation

    It's there for the taking with a quick:
    $ git clone  https://github.com/ZiCog/P8X32A_Emulation.git
    
    Or just hit the "Download ZIP" button on that page.

    The tabs to spaces change is the only change I have made to that code so you are good to go.

    By the way, I used the Sublime Text editor which can view those original files correctly and then save them with the tab issue corrected. Doing a naive tab to space swap will make a mess of things, don't do that. Just fetch my version.
  • cgraceycgracey Posts: 14,155
    edited 2014-08-12 00:46
    Heater. wrote: »
    Having tabs in the source is a real no-no.

    Yes some editors can sort this out for you and display the thing correctly. Not all do. It also goes wrong in other circumstances, for example when browsing the code on the pages of GitHub. Or try cutting and pasting a snippet of that source into a post on this forum, it will be screwed.

    Worst of all if you have contributors not following the "no tabs rule" you will end up with source that contains spaces and tabs all mixed up. You will get people "fixing" that formatting when they see it. This all makes viewing diffs between different versions much harder as all those non-functional space changes will show up in the diffs.

    Just say no to tabs. I beg you...on my knees here...


    I could but I won't. The tab free source is posted in github here : https://github.com/ZiCog/P8X32A_Emulation

    It's there for the taking with a quick:
    $ git clone  https://github.com/ZiCog/P8X32A_Emulation.git
    
    Or just hit the "Download ZIP" button on that page.

    The tabs to spaces change is the only change I have made to that code so you are good to go.

    By the way, I used the Sublime Text editor which can view those original files correctly and then save them with the tab issue corrected. Doing a naive tab to space swap will make a mess of things, don't do that. Just fetch my version.


    Thanks for doing that. I take it these are the new files that we posted this afternoon that have the DIRA reset fix and the BeMicroCV support?
  • jmgjmg Posts: 15,173
    edited 2014-08-12 00:48
    Heater. wrote: »
    .... Doing a naive tab to space swap will make a mess of things, don't do that.
    I presume you meant a simple replace TAB with one char ?

    The Notepad++ Edit feature I mentioned is somewhat smarter, and works nicely in both directions, & replaces TAB with 8 chars (or whatever you have set), and going back swaps a TAB in for every adjacent 8 spaces.
    Makes it easy to support both standards, if someone really wants to.
  • Heater.Heater. Posts: 21,230
    edited 2014-08-12 01:03
    Chip,

    No, my gihub version is 5 days old already. It is basically as you released it with only the tabs fixed. I added a license file to the top level directory where it should be and a README.md describing what it all is. I also threw in the pdf docs for convenience.

    You can see what is what by browsing the code on git hub, for example here: https://github.com/ZiCog/P8X32A_Emulation/tree/master/P8X32A_DE0_Nano where the DE0-nano files are listed together with a commit comment.
    Click on that comment on a .v file and you will see all the tab to space changes that were made, yuk, this is what happens when contributors mix up spaces and tabs and generally mess with formatting.

    I was just wondering about what to do with the DIRA reset fix and BeMicro support changes.

    What we should do is as follows:

    1) You make your self a fork of my github repo. That only requires that Parallax signs itself up for github, you then visit my repo page and hit the "fork" button. Boom you have your own clone in the Parallax account.

    2) You fix up the reset and BeMicro stuff in the Parallax repo.

    3) You send a "pull" request to me.

    4) I pull those changes into my version from the Parallax repo.

    5) I transfer ownership of the whole thing over to Parallax.
  • Heater.Heater. Posts: 21,230
    edited 2014-08-12 01:21
    jmg,
    I presume you meant a simple replace TAB with one char ?
    No.
    What I meant is that we are told that in the original source a TAB is four spaces.
    If you simply replace every TAB with four spaces you do not get what you want.
    A TAB is not simple a representation of a number of spaces. A TAB moves you out to "tab stops" which may be positions in the line separated by a fixed number of spaces or not. Word processors often have tab stops set all over the place.
    When you have tabs AND spaces used to format your code, as the P1 design does, things get even worse.

    Yes, slightly smart editors can figure this out and display things correctly. Sublime Text being an example. Not all editors can. Code will get into a mess if there is not a "no-tab" rule in place.
  • Heater.Heater. Posts: 21,230
    edited 2014-08-12 01:28
    Chip,

    Scratch what I said above.

    Probably the better idea is that Parallax get's itself a github account. And then I transfer owner ship of my repo to Parallax as is.
    Transferring ownership is an easy two minute job. See here: https://help.github.com/articles/how-to-transfer-a-repository
    This way, whatever there is as a change history already stays intact.

    Send me a P.M. when you are ready to go...

    Then you can make the reset and BeMicro support changes your self:)


  • rjo__rjo__ Posts: 2,114
    edited 2014-08-24 10:44
    I am certain that I used the correct sources. After recompiling:

    At startup everything is fine. P1v found and can be programmed successfully.

    When I don't have an EEPROM hooked up, I am having no reset on either Nano or DE2-115. P1v can't be found after an initial run. A power cycle is required.

    When I do have an EEPROM hooked up with pull-ups(nano and DE2), I can program the EEPROM and it runs fine.
    However, after the initial run, it then fails to find the P1v on any attempt to program(or identify hardware) and reboots from EEPROM.
  • pik33pik33 Posts: 2,366
    edited 2014-08-24 12:18
    I had no reset problem after fixing the bug. My P1V resets dira and outa (as well as dirb and outb), I didn't removed outa resetting from my version of p1v.
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-24 12:27
    I am using 32bit Quartus on an XP... probably doesn't matter. I am using a Mac to program. Had the same issue under bst and PropellerIDE, I wonder if this makes the difference. I have rechecked everything.
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-24 12:48
    This is what I have. Unless my tired brain is confused, seems to be what is above.
    // outa/dira
    
    reg [31:0] outa;
    reg [31:0] dira;
    
    always @(posedge clk_cog)
    if (setouta)
    	outa <= alu_r;
    
    always @(posedge clk_cog or negedge ena)
    if (!ena)
    	dira <= 32'b0;
    else if (setdira)
    	dira <= alu_r;
    

    I tried it on XP using my Nano half P1v and Propeller Tool, no luck.

    Thanks.
  • GarethGareth Posts: 278
    edited 2014-08-24 14:44
    Wow this is a neat system... and scary at same time.

    Just to confirm the build 60050,60056-Propeller-1-Design-2014-08-11.zip compiled and loaded to my Deo Nano and is running a test serial program... YAY... Hats off to the development team.
    +1 for the "which cog is running LED indicators"

    Is there a limitation to the number of cogs that can be assimilated (or is that just memory dependant) !?
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-27 18:42
    oops...

    I went back and re-read Brian's thread http://forums.parallax.com/showthread.php/156804-Reset-issues-on-DE0-Nano-DE2-115 turns out that if my code does not use a serial terminal, it loads and resets just fine.

    Likewise, if I do use FDS and then send ser.Stop before the program terminates, reset is fine...ahhhhmmmmm....no. Worked a couple of times in a row. Now, not. I'll try a different prop-plug,

    Sorry.

    Rich
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-27 21:54
    :) lol... I have substituted every piece of code into that section... except the right piece... will have to try that later.
    One of my problems is that I walk away during compile time, intending to come right back and then I find something else, equally interesting (of course:)

    Tonight was a technical failure. But it sure was entertaining!
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-28 08:29
    I think I can safely say that I have checked and rechecked all of the patches for the Nano with two different Prop plugs. All of them work, with or without EEPROM... if there is no FDS involved.
    None of them work after an initial run (haven't tried mind robots patch with EEPROM) if FDS is used. This is true, even when I stop FDS in (my spin file) after using it. With Chip's patch, trying to identify hardware after FDS is used causes a successful reboot from the EEPROM. And on startup, in order to avoid booting from the EEPROM and to be able to reprogram the EEPROM, I disconnect the +3.3V from the EEPROM until after the power is applied to the Nano.

    After applying one of the patches(not Chip's), when I disconnected the PropPlug from the powered up Nano, my Mac crashed...IDK:)
  • ozpropdevozpropdev Posts: 2,792
    edited 2014-08-28 21:30
    Rich,
    One area that caught me out with Quartus was when using "Convert programming files" that the "Input file to convert" (*.sof) is the correct path and not the path of the same named from the copied project. This caught me out early on as none of my changes seemed to make any difference at all.
    Turns out I was programming the FPGA with the "original" image and not the new image.
    Maybe that's what your experiencing.
    Cheers
    Brian
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-28 21:43
    Brian

    Thanks. Tonight I made some changes using Textwrangler on my Mac. I passed them over to my xp machine. And it wouldn't compile. When I opened the file in quartus on the xp machine it was corrupted. When I fixed it in quarts it ran just fine. I owe Alters an apology. I really don't care about the reset issue, but it makes me curious. Am I the only one that can't run fds without it causing a reset problem:)?
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-08-29 00:22
    ozpropdev wrote: »
    Rich,
    One area that caught me out with Quartus was when using "Convert programming files" that the "Input file to convert" (*.sof) is the correct path and not the path of the same named from the copied project. This caught me out early on as none of my changes seemed to make any difference at all.
    Turns out I was programming the FPGA with the "original" image and not the new image.
    Maybe that's what your experiencing.
    Cheers
    Brian
    Just got caught out with this myself today. Copied my working directory to make some changes while keeping the original :(
  • rjo__rjo__ Posts: 2,114
    edited 2014-08-31 06:10
    Am I the only one that can't run fds without it causing a reset problem?

    Yes!!!

    I somehow got in the habit of trying to run from a .sof file... I don't know if this works on Windows... but once you power down and hook it up to a Mac, the results aren't going to be good. ROFL
Sign In or Register to comment.