Menu

Interfacing

2010-10-11
2012-11-19
  • Normand Roussel

    Normand Roussel - 2010-10-11

    I just wonder if anyone as implemented FlashForth on a dsPIC30F4011?
    If not, what would be the necessary change to the source code.
    Also, Is there any hardware interfacing diagram avaliable around for the ff4.6 (3012)
    Regards
    N.R.

     
  • Mikael Nordman

    Mikael Nordman - 2010-10-11

    There should be no code changes needed.
    Just update the configuration file, select dsPIC4011 in the MPLAB IDE compile and program your chip with
    a programmer device (ICD2, pickit2, etc…).
    You also need to connect the serial interface via a RS232 (MAX232 chip)  to your computers serial port.

    Mikael

     
  • Normand Roussel

    Normand Roussel - 2010-10-11

    Thanks, Mikael
    accept my best regards
    N.R.

     
  • Pete Zawasky

    Pete Zawasky - 2010-10-12

    The board and PIC chip I have been using is the 16-BIT 28P STARTER DEMO BOARD DM300027  with dsPIC30F4012.
    4.6 works well and I will be trying 4.7 on it soon.

    Pete

     
  • Normand Roussel

    Normand Roussel - 2010-10-13

    Sorry I am not an expert with MPLAB, dsPIC4011 was selected.
    MPLAB tells me that "BUILD SUCCEEDED" and that programming also succeeded .
    But, there is no sing of activity on any uart port using  the RS232 interface (38400, 1, N, XON/XOFF).
    Triyng to program the chip with Pickit2 programmer (importing hex file) give me this warning:
    "Some configuration words not in hex file…" ??
    Thanks helping

     
  • Pete Zawasky

    Pete Zawasky - 2010-10-13

    Could you please give more information about your RS232 Interface and the actual serial port connection to the 4011?

    On my DM300027 Demo Board, I added a Maxim MAX3221 uart chip for the RS232 communications to the U1RX and U1TX pins. I remove the PICkit 2 after programming and make sure the USB Communications is not selected.

    I use a PICkit 2 here also and have seen that message but it was not a problem.   I have had to program the 4012 twice occasionally and then cycle power with the PICkit 2 removed.

    Make sure when compiling that the Alternate I/O selection  is correct for your 4011 board.

    Pete

     
  • Mikael Nordman

    Mikael Nordman - 2010-10-13

    Normand,
    How does your ff30.inc look like ?
    Is your oscillator oscillating
    To which pins is your RS-232 level converter connected ?
    Which linker file did you use ?

     
  • Normand Roussel

    Normand Roussel - 2010-10-13

    The exact frequency mesure on  osc1 (13) is 15,980,032 Hz . Is this close enough ?
    The level converter is a MAXIM max232CPE.
    I have tryed pin 26 of dsPic(U1RX) on R2out pin 9 of max converter
    and pin 25 of dsPic(U1RX) on T2in pin 10 of max converter
    I have also tryed with U2 RX and TX
    There was no change made to the original ff30.inc
    And the linker file is p30f4011.gld
    Regards

     
  • Mikael Nordman

    Mikael Nordman - 2010-10-13

    Use pins 25/26  with setting
    .equ USE_ALTERNATE_UART_PINS, 0

    At least the baudrate is too high for 16 MHz clock.
    Try with 9600 baud.
    .equ BAUDRATE, 9600 ; Serial baudrate

    Unfortunately the default baudrate configuration is wrong.
    I need to fix that.

     
  • Pete Zawasky

    Pete Zawasky - 2010-10-13

    Here is the core of my .inc file  for the 4012…..

    This expects an external xtal.

    Pete
    ***************************************************************************************

    ;…………………………………………………………….
    ;Configuration bits:
    ;…………………………………………………………….

    ;config __FOSC,  HS            ;Turn off clock switching and
                                  ;fail-safe clock monitoring and
                                  ;use the External HS Clock as the
                                  ;system clock

    config __FOSC, CSW_FSCM_OFF & XT_PLL8
                                  ;Turn off clock switching and
                                  ;fail-safe clock monitoring and
                                  ;use the External XT Clock as the
                                  ;system clock - 7.3728MHz xtal and 8xPLL

    ;**********************************************************************

    config __FWDT, WDT_ON              ;Turn on Watchdog Timer

    ;config __FWDT, WDT_OFF              ;Turn OFF Watchdog Timer

    ;**********************************************************************

    config __FBORPOR, PBOR_ON & BORV_27 & PWRT_16 & MCLR_EN
                                        ;Set Brown-out Reset voltage and
                                        ;and set Power-up Timer to 16msecs
                                               
    config __FGS, CODE_PROT_OFF         ;Set Code Protection Off

    ;**********************************************************************
    ;.equ FREQ, 16000000                ; Osc frequency Hz
    ;.equ BAUDRATE, 38400               ; Serial baudrate
    ;.equ BAUD_DIV1, (FREQ/(16*BAUDRATE))-1; UART divisor

    .equ XTFREQ, 7372800         ;On-board Crystal frequency
    .equ PLLMODE, 8              ;On-chip PLL setting
    .equ FREQ, XTFREQ*PLLMODE/4  ;Instruction Cycle Frequency (Fcy)
                                 ;End result is 14745600 Hz
    .equ BAUDRATE, 38400
    .equ BAUD_DIV1, ((FREQ/BAUDRATE)/16)-1 ; UxBRG value

    ;**********************************************************************
    .equ MS_PR_VAL, (FREQ/1000)     ; Timer value for 1 ms ticks

    ;**********************************************************************
    ; Set to 1 to use the alternate UART pins.
    ;        0 if you use the normal UART pins.
    .equ USE_ALTERNATE_UART_PINS,0

    ;**********************************************************************
    ; Flash write delay
    .equ write_delay, 20

    ;**********************************************************************
    ; Set to 1 for extra debug info after an exception reset.
    ;        0 for no extra debug info.
    .equ DEBUG_INFO,1

    ;**********************************************************************
    ; Set to 1 to allow control-o to reset FlashForth.
    ;        0 to not respond to control-o.
    .equ CTRL_O_WARM_RESET, 0

     
  • Mikael Nordman

    Mikael Nordman - 2010-10-13

    I just uploaded a new version of FF 4.6.
    It has better default values on the configuration file.
    - Normal serial I/O pin is default
    - Internal FRC*PLL8 is default (58 MHZ clock)
    - 38400 baud UART is still default
    - Extra DEBUG data is not printed as default

     
  • Normand Roussel

    Normand Roussel - 2010-10-13

    Using the inc file  from "pzawaski" give this result on the RS232 monitor:
    -FlashForth V4.6 on dsPIC30F
    -(C) Mikael Nordman GPL V3
    But using the enter key result in an a repetition of the (i) code.
    Resetting the dsPIC4011 and typing any character give this message
    -a Compile Only
    I will download the new version and let you know.
    regards
    

     
  • Normand Roussel

    Normand Roussel - 2010-10-14

    There must be someting wrong somewhere.
    Using .equ XTFREQ, 16000000 with "pzawaski" INC file made FlashForth working properly.
    To verify the programming procedure used I erased the chip and try to reprogram it with the exact same setup.
    After many tries I can't make it work properly ??????????????????
    Regards

     
  • Normand Roussel

    Normand Roussel - 2010-10-14

    Thanks for helping..
    FlashForth is Working perfectly on windows XP with the stadard COM port.
    I was working on my portable Midows 7 pro witch have no RS232
    It is not working  using an RS232 to USB converter   .Why ??
    Best Regards to all

     

Log in to post a comment.