Shop OBEX P1 Docs P2 Docs Learn Events
Booting from flash on the P2 — Parallax Forums

Booting from flash on the P2

roglohrogloh Posts: 5,122
edited 2021-12-10 05:30 in Propeller 2

Is a 47k pullup resistor sufficient on P61 to get the P2 booting from SPI flash or is something else required?

I have a Winbond SPI flash chip (W25Q128JVSIM) installed on my board with a 47k pullup resistor on the CS pin (P2 IO pin P61), and the other 3 SPI flash pins are connected directly through to the P2 with no other pullups or pulldowns and no SD socket fitted etc. I can see the SPI flash from the P2 and can erase and write to it and dump it out and it looks like it takes the binary, but at this stage it doesn't seem to let me boot my P2 binary application from it (still testing that). Maybe I've overlooked something simple or there is another issue for me to resolve.

I noticed that the P2-EVAL board uses a 10k pullup while mine was 47k. Should the actual pullup resistance used matter here in the boot detection routine? Hoping not.

Comments

  • roglohrogloh Posts: 5,122
    edited 2021-12-10 05:42

    I wondered if I had some internal board resistance on P59 pulling it up. But TAQOZ seems to say they are floating except for P61 (as expected). So it seems okay.

      Cold start
    -------------------------------------------------------------------------------
      Parallax P2  .:.:--TAQOZ--:.:.  V1.1--v33h         190219-1900
    -------------------------------------------------------------------------------
    TAQOZ# lsio --- 
    P:00000000001111111111222222222233333333334444444444555555555566
    P:01234567890123456789012345678901234567890123456789012345678901
    =:~~dd~~dd~~~~~~~~~~~~~~~~d~d~~hhh~dd~~~~~~~~~~hh~~~h~hhdd~~~~~h ok
    TAQOZ# 
    
  • roglohrogloh Posts: 5,122
    edited 2021-12-10 07:22

    Hmm, this is strange.
    I have created a simple program to toggle an LED on both the P2-EVAL (pin 56) and my own board (pin 31).

    CON
      _clkfreq = 160000000
    
    PUB begin
        repeat
            pintoggle(31)
            pintoggle(56)
            waitms(500)
    

    This creates a short binary with flexspin:

    00000000  00 00 00 00 01 ec 63 fd  02 00 00 ff 04 ec e7 fc  |......c.........|
    00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000400  00 a4 05 06 00 f0 0f f2  0c 02 90 5d d1 f0 03 f6  |...........]....|
    00000410  14 ec 0f fb ec 01 90 5d  00 00 64 fd 03 80 80 ff  |.......]..d.....|
    00000420  00 f0 67 fd 86 01 80 ff  1f 80 66 fd 03 80 00 ff  |..g.......f.....|
    00000430  fb ed 07 f6 00 ec 63 fd  18 ec 67 fc b4 c4 84 ff  |......c...g.....|
    00000440  14 00 6c fc bc 01 90 fd  00 00 00 00 00 00 00 00  |..l.............|
    00000450  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000600  00 00 00 00 50 07 a0 fd  38 01 80 ff 1f 00 66 fd  |....P...8.....f.|
    00000610  01 a6 61 fd 03 a6 61 fd  00 9f 05 fb 04 f0 07 f1  |..a...a.........|
    00000620  00 a5 05 fb 04 f0 07 f1  00 a7 05 fb 04 f0 07 f1  |................|
    00000630  00 a9 05 fb 04 f0 07 f1  00 ab 05 fb 04 f0 07 f1  |................|
    00000640  00 ad 05 fb 10 f0 87 f1  2d a4 61 fd b8 ff 9f fd  |........-.a.....|
    00000650  2b 3e 61 fd f6 3f 01 f1  2a 3e 61 fd f6 3f 81 f1  |+>a..?..*>a..?..|
    00000660  02 ec 47 f0 00 ec 8f f9  9e 00 00 f6 01 ec 87 f1  |..G.............|
    00000670  28 ec 63 fd 9f 00 00 fb  00 00 80 fd 2d 00 64 fd  |(.c.........-.d.|
    00000680  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    00000690  2b ec 63 fd 2b 42 61 fd  04 40 95 fb 01 40 85 f1  |+.c.+Ba..@...@..|
    000006a0  28 40 61 fd 00 af 65 fc  01 40 05 f1 02 40 65 f0  |(@a...e..@...@e.|
    000006b0  a0 f0 03 f1 02 40 45 f0  28 04 64 fd 00 41 65 fc  |.....@E.(.d..Ae.|
    000006c0  0c f0 07 f1 f8 45 01 f6  2c ec 63 fd 2b ec 63 fd  |.....E..,.c.+.c.|
    000006d0  0c f0 87 f1 28 04 64 fd  00 41 05 fb 06 40 95 fb  |....(.d..A...@..|
    000006e0  02 40 65 f0 a0 f0 83 f1  02 40 45 f0 01 40 85 f1  |.@e......@E..@..|
    000006f0  28 40 61 fd 00 af 05 fb  2a 42 61 fd 2c ec 63 fd  |(@a.....*Ba.,.c.|
    00000700  28 00 64 fd db b4 11 fd  18 b6 61 fd 19 b4 61 0d  |(.d.......a...a.|
    00000710  da b4 51 f6 03 9c 85 f5  db b6 59 f6 02 9c 65 c5  |..Q.......Y...e.|
    00000720  2d 00 64 ad d8 ff bf fd  01 9c d5 f7 da b4 81 f6  |-.d.............|
    00000730  02 9c d5 f7 db b6 81 06  00 00 00 00 00 00 00 00  |................|
    00000740  00 08 00 00 e8 07 00 00  00 08 00 00 00 00 00 00  |................|
    00000750  5f 3e 64 fd 5f 70 64 fd  f4 a7 05 f6 0c 00 b0 fd  |_>d._pd.........|
    00000760  ec ff 9f fd 2d 00 64 fd  81 00 80 fd 03 40 05 f6  |....-.d......@..|
    00000770  a3 00 a0 fd d3 ae 01 f6  14 b0 05 fb 98 f8 9f fe  |................|
    00000780  93 00 a0 fd 01 00 00 ff  e8 af 5d f2 1f b0 61 1d  |..........]...a.|
    00000790  01 00 00 1f e8 af 85 11  e8 ff 9f 1d 0c a0 05 f1  |................|
    000007a0  d0 b2 09 fb 0c a0 85 f1  20 00 90 5d d8 b4 01 f6  |........ ..]....|
    000007b0  01 00 00 ff e8 b7 05 f6  bf 00 a0 fd db b2 01 f6  |................|
    000007c0  0c a0 05 f1 d0 b6 61 fc  0c a0 85 f1 00 ae 5d f2  |......a.......].|
    000007d0  d9 ae 01 1d 18 a6 61 1d  1f a6 61 1d a2 f0 03 f6  |......a...a.....|
    000007e0  b2 00 a0 fd 2d 00 64 fd  00 00 00 00 00 00 00 00  |....-.d.........|
    000007f0  03 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    00000800  00 00 00 00                                       |....|
    

    I then flash both the boards (P2-EVAL and my board) with this same binary using this type of command (and also changing the serial port name for my own board):

    loadp2 -p /dev/cu.usbserial-DN43U3VJ @0=/Users/roger/Code/loadp2/board/P2ES_flashloader.binary,@8000+led.binary -b 250000 -l 250000 -t
    

    After flashing, the P2-EVAL starts up and blinks the LED after reset, while mine does nothing. Downloading into RAM first to verify the code had worked fine on both boards.

    When I used JohnnyMac's flash explorer program I captured the interesting range of flash addresses and diffed them between both boards. I only saw data differences right after the led binary which I am presuming was just the last 512 bytes of random P2 RAM that got flashed at the end of the program along with the code and that would have differed on both boards.

    I still can't figure out how my board won't boot this code from flash. A CRC/checksum corruption perhaps? Probing these P2/Flash SPI pins will be a nightmare in circuit as the signals are sandwiched between two boards, though I probably could try with the P2ME2 removed and booting standalone. At least the CS pin would indicate flash boot activity.

  • roglohrogloh Posts: 5,122
    edited 2021-12-10 12:31

    So I found I was looking in the wrong area. At startup my AVR supervisor micro (propplug replacement) was doing something funky with its TX output into the P2's RX pin and it looked like it could be held low at boot time in some cases and I think this must have been preventing the bootup from flash. When I modified this pin control portion of the AVR code, flash boot on my P2ME2 suddenly started working. :smile:

    I still need to figure out exactly in what logical order all these pin control changes are happening but this adjustment certainly allowed it boot from flash while it wouldn't work before. I know I need to drive this signal low at times to ensure it doesn't parasitically drive the P2 when it is powered off. I probably just need better co-ordination with the P2 reset and its powering and shutdown sequence.

    P.S. Wow. Loving how fast this thing boots from flash... press the power on button and LCD outputs something immediately. Beat that, Raspi.

  • @rogloh said:
    I still can't figure out how my board won't boot this code from flash. A CRC/checksum corruption perhaps? Probing these P2/Flash SPI pins will be a nightmare in circuit as the signals are sandwiched between two boards, though I probably could try with the P2ME2 removed and booting standalone. At least the CS pin would indicate flash boot activity.

    Found out the hard way the directions are unclear and you have to flip a switch on the eval board for the Propeller Tool to be able to program the flash. There is no real reference to this in any of the documentation but there is one cryptic chart that shows what switch needs flipped. Personally, as an equipment developer myself I deal with this a lot, incomplete documentation cause user errors 99% of the time.

    I was able to bypass the switch requirement with FlexProp and it would program the flash without an issue which made the problem appear to be the Propeller Tool when it was not.

    Might have something to do with your problem.

Sign In or Register to comment.