Shop OBEX P1 Docs P2 Docs Learn Events
GCC code is not working on my prop - Page 2 — Parallax Forums

GCC code is not working on my prop

2»

Comments

  • I added transistor reset circuit and nothing changes. I installed CP2102 drivers on Windows no got the same build error.
  • I have Raspbery Pi 3. Is there any possibility to downloading through SimpleIDE on it via GPIO ports? (Not using any converter modules.)?
  • I think Cluso99 is leading you up the garden path because if he had read your other posts where you have successfully downloaded Spin programs with the same setup, then he would realize that the CP2102 circuit must work. If you are sure that you can do this with Spin then just make sure that your hardware will work with the 8MHz crystal by taking that Spin program and setting it up for an 8MHz crystal x8.
    _clkmode        = xtal1 + pll8x
    _xinfreq        = 8_000_000
    sysfreq         = 64_000_000
    
    If the Spin program won't run with this setting then try a lower PLL in case you are having supply problems or you are trying to run without "proper" bypass capacitors on Vdd/Vss. It could be that the Spin program is running simply because it is using the default RCSLOW and not the crystal. Anyway, the main thing is to make sure the Spin program that does run, will run with different configurations. If it passes those tests then it must be your software.
  • ShizuShizu Posts: 16
    edited 2017-12-30 16:46
    Ok. So this is code:
    _clkmode        = xtal1 + pll8x
    _xinfreq        = 8_000_000
    sysfreq         = 64_000_000
    
    PUB main
    clkset(CLKMODE, sysfreq)
    dira[0] := 1
    repeat
        outa[0] := 1
        waitcnt(CLKFREQ/2+CNT)
        outa[0] := 0
        waitcnt(CLKFREQ/2+CNT)
    
    
    

    This code works. Then it must be my software.
  • Cluso99Cluso99 Posts: 18,069
    Peter, etc
    Some loaders use multiple resets during the download process. The way the prop works, coupled with the way PCs work particularly Windows, can and does, cause loading problems under some circumstances. The transistor reset circuit is designed to work with these peculiarities. I could go on and describe how Windows interacts with the serial comma port but it's not necessary.

    I know some have used various circuits instead of the transistor circuit with some success. This does not mean that it will work every time.

    IMHO, the transistor reset circuit SHOULD BE CONSIDERED MANDATORY whenever downloading is not working properly. If you get by without it, you are just lucky, because it will bite you sooner or later!

    This is why I put the transistor/resistor/capacitor on my tiny boards.

    Once the hardware can be expected to work properly, then it's time to move on to check other things.
  • ShizuShizu Posts: 16
    edited 2018-01-03 10:02
    I was going to give up. But finaly I got gcc code working. Thank you all for your advices. The problem why GCC code did not works was really related with clock and software. I found /opt/parallax/propeller-load folder and some configure files and then I changed PLL and clkfreq constants in .cfg file which I am usining for uploading and after I did it finaly blinks.
  • Shizu wrote: »
    I was going to give up. But finaly I got gcc code working. Thank you all for your advices. The problem why GCC code did not works was really related with clock and software. I found /opt/parallax/propeller-load folder and some configure files and then I changed PLL and clkfreq constants in .cfg file which I am usining for uploading and after I did it finaly blinks.

    That is awesome that you finally have this working. Nice Job!

    Could you please provide more details as to what and where you made your changes?
  • ShizuShizu Posts: 16
    edited 2018-01-03 20:05
    JonM,
    As I think those people who don't buy standalone uC and uses ready for use board with already soldered serial converter, ROM, etc, and xtal oscillator (5MHz as usual) will not face such propblem. And as I think if I soldered 5Mhz xtal instead of 8Mhz one, everything was working nice. But sometimes there is no 5Mhz xtal on hand (and unfortunately there were no such xtals in my near shops at time when i started with soldering).

    SimpleIDE installs in your /opt LInux (and maybe Mac) directory such folders:
    $ ls /opt/parallax
    bin      lib      propeller-elf   share  Workspace
    include  libexec  propeller-load  spin
    

    propeller-load folder contents configure files for different boards as I see.
    $ ls /opt/parallax/propeller-load
    activityboard.cfg             rampage2.cfg
    asc.cfg                       rcfast.cfg
    ascp.cfg                      rcslow.cfg
    c3_cache.dat                  sd_cache.dat
    c3_cache_flash.dat            sd_cache_loader.elf
    c3.cfg                        sd_driver.dat
    c3f.cfg                       sd_loader.elf
    demoboard.cfg                 sdram_cache.dat
    dna.cfg                       sdram.cfg
    dna-nway.cfg                  spi_flash_cache.dat
    dracblade_cache.dat           spi-flash.cfg
    dracblade.cfg                 spinstamp.cfg
    eeprom_cache.dat              spi_nway_flash_cache.dat
    eeprom.cfg                    spi_nway_sram_cache.dat
    fast_spi_flash_cache.dat      spi_sram_cache.dat
    fast_sst_spi_flash_cache.dat  sqi-flash.cfg
    hub.cfg                       ssf_cache.dat
    hydra.cfg                     ssf.cfg
    pks.cfg                       sst.cfg
    pp-usb-2.cfg                  sst_spi_flash_cache.dat
    ppusb.cfg                     sst_sqi_flash_cache.dat
    propboe.cfg                   sst_sqi_nway_flash_cache.dat
    propstick.cfg                 synapse_cache.dat
    protoboard.cfg                synapse.cfg
    quickplayer.cfg               winbond.cfg
    quickstart.cfg                winbond_sqi_flash_cache.dat
    rampage2_cache.dat            winbond_sqi_nway_flash_cache.dat
    

    In SimpleIDE (or in Makefile adding -b <BOARD_NAME> parameter) you chooses your board, so it uses one if this configure files for loader.

    For example:
    $ cat /opt/parallax/propeller-load/activityboard.cfg
    # Propeller activity board configuration.
    # IDE:SDXMMC
        clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        cache-driver: eeprom_cache.dat
        cache-size: 8K
        cache-param1: 0
        cache-param2: 0
        eeprom-first: TRUE
        sd-driver: sd_driver.dat
        sdspi-do: 22
        sdspi-clk: 23
        sdspi-di: 24
        sdspi-cs: 25
    

    So then you see - clkfreq and clkmod values must be changed for your xtal and you final freq. These configure file, as i think must be in same way named directory in Windows too.

    Or you can chose RCFAST config file without using PLL.


    Maybe it be usefull for someone.











  • Okay, I got that, but what did you change? Your activityboard.cfg looks just the one on my Mac but my Activity board has a 5.00M crystal and works just fine.

    The reason I am curious is that I have a few Propeller P8X32A MCUs and am considering to replace a FLiP with one as well as work on other projects with these.

    Thanks.
  • Shizu wrote: »
    JonM,
    As I think those people who don't buy standalone uC and uses ready for use board with already soldered serial converter, ROM, etc, and xtal oscillator (5MHz as usual) will not face such propblem. And as I think if I soldered 5Mhz xtal instead of 8Mhz one, everything was working nice. But sometimes there is no 5Mhz xtal on hand (and unfortunately there were no such xtals in my near shops at time when i started with soldering).
    ~~~
    So then you see - clkfreq and clkmod values must be changed for your xtal and you final freq. These configure file, as i think must be in same way named directory in Windows too.

    What were your final clock settings? PLL8X for that 8MHz xtal?
  • ShizuShizu Posts: 16
    edited 2018-01-04 13:34
    JonM, mikeologist

    I changed clkfreq to 64000000. And clockmode to XTAL1+PLL8X.
    So now .cfg looks like:
    $  cat /opt/parallax/propeller-load/quickstart.cfg
    # quickstart.cfg
        clkfreq: 64000000
        clkmode: XTAL1+PLL8X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        tvpin: 12   # only used if TV_DEBUG is defined
        cache-driver: eeprom_cache.dat
        cache-size: 8K
        cache-param1: 0
        cache-param2: 0
        eeprom-first: TRUE
    

    And my Makefile:
    $ cat Makefile
    PROPGCC=/opt/parallax
    CC=${PROPGCC}/bin/propeller-elf-gcc  
    LOAD=${PROPGCC}/bin/propeller-load  
    CFLAGS=-Os -mlmm -m32bit-doubles  -fno-exceptions  -std=gnu99
    BOARD=QUICKSTART
    PORT=/dev/ttyUSB0
    
    .PHONY: all clean load
    
    all: main
    
    clean:  
    	rm main *.o
    
    flash: main  
    	${LOAD} -b ${BOARD} -p ${PORT} -I ${PROPGCC}/propeller-load -r -e -Dreset=dtr $<
    

    One thing I dont get, why it wasn't working when I was trying to upload without selecting any board. Maybe it is necessary to configure rx,tx pins, clock and freq settings when uploading. Or I was doing something wrong.

  • Shizu wrote: »
    One thing I dont get, why it wasn't working when I was trying to upload without selecting any board. Maybe it is necessary to configure rx,tx pins, clock and freq settings when uploading. Or I was doing something wrong.
    The loader has defaults it uses if you don't select a board type. The defaults assume a 5mhz crystal and an 80mhz clock speed.

  • mikeologistmikeologist Posts: 337
    edited 2018-01-04 13:59
    The config comes with selecting the board type, notice the file name, and again in the make file. SimpleIDE selects activityboard by default to prevent that.

    Edit: (this was in spin) I forgot to init my clock once and it took me 10 minutes to figure out the gibberish on my terminal.
  • ShizuShizu Posts: 16
    edited 2018-01-04 20:34
    One more thing - Can anyone give me linker script files and makefile for skeleton gcc projects. I am not good at makefiles and linker scripts. I need to compile and link multiple files into one elf file for loading.
Sign In or Register to comment.