• AVR Freaks

Hot!Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP

Author
yts
Super Member
  • Total Posts : 632
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
2019/09/30 16:44:45 (permalink)
0

Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP

Environment: core: v3.4.0, csp: v3.4.0

The problem arises with hysteresis when #3 pin (RA1 pin) is set to SDI1.

Case 1:
If you do the followings
1.    Set #3 pin to GPIO output pin
2.    Generate code
3.    Set #3 pin to SDI1
4.    Generate code

then SDI1 remains to be an OUTPUT pin.

In fact, TRISACLR is set to 0x13 as seen in the plib_gpio.c file


void GPIO_Initialize ( void )
{
    /* PORTA Initialization */
    LATA = 0x0; /* Initial Latch Value */
    TRISACLR = 0x13; /* Direction Control */ <---------------


This prevents the SPI communication.

Case 2:
If you do the followings
1.    Set #3 pin to GPIO input pin
2.    Generate code
3.    Set #3 pin to SDI1
4.    Generate code

then SDI1 is set to an INPUT pin.
In fact, TRISACLR is set to be 0x11.
As a result, the SPI works fine.

yts
#1

5 Replies Related Threads

    ric
    Super Member
    • Total Posts : 27968
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP 2019/09/30 17:24:30 (permalink)
    5 (1)
    There have been several reports along the same lines.
    i.e. Harmony works well if you start from scratch, and set everything exactly right on your first try.
    But, it falls over if you turn something on, then turn it off again.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    yts
    Super Member
    • Total Posts : 632
    • Reward points : 0
    • Joined: 2005/09/06 17:45:30
    • Status: offline
    Re: Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP 2019/09/30 18:08:00 (permalink)
    0
    Hi, ric:

    It's been a long time since I saw you in my topic.

    Thank you for your information.

    I will be careful bout this type of issue from now.

    yts
    post edited by yts - 2019/09/30 18:35:56
    #3
    Jim Nickerson
    User 452
    • Total Posts : 6715
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP 2019/10/01 06:55:39 (permalink)
    0
    ric
     
    But, it falls over if you turn something on, then turn it off again.

    They have been working on the merge changes for quite a while now.
    It seems this task is much more difficult than they first imagined.
    I agree with your observations.
     
    #4
    arpananand
    Super Member
    • Total Posts : 498
    • Reward points : 0
    • Joined: 2009/11/18 04:35:42
    • Location: 0
    • Status: offline
    Re: Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP 2019/12/07 23:37:07 (permalink)
    0
    this issue will be fixed in upcoming release.
     
    #5
    hudejun
    Electrical engineer
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2019/12/05 08:48:06
    • Location: 0
    • Status: offline
    Re: Harmony 3: SDI1 pin-setting for SPI in PIC32MX270F256B-50I/SP 2019/12/08 06:07:10 (permalink)
    0
    *****************************************
    Case 1:
    If you do the followings
    1.    Set #3 pin to GPIO output pin
    2.    Generate code
    3.    Set #3 pin to SDI1
    4.    Generate code

    then SDI1 remains to be an OUTPUT pin.
    *****************************************
    Is this error?
    PLIB_PORTS_RemapInput(PORTS_ID_0, INPUT_FUNC_SDI1, INPUT_PIN_RPA1);
    This functions sets only port remap registers.
    You must init RA1 pin as input type manually.
     
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5