+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 2
    Points: 23, Level: 1

    Join Date
    Aug 2019
    Posts
    2
    Helped
    0 / 0
    Points
    23
    Level
    1

    dsPIC33F I2C" Start hold time violated"fuse configs

    Hello All,
    I'm using dsPIC33FJ32GP204. I'm kind of newbie and sorry for the easy mistakes first of all.I 'm trying to do my research.
    I wrote a code that in CCS C works well for PIC16F877 using i2c that communicates with eeproms and lcd. But when I copy paste it to the dsPIC33f ( changig with device id) when i use proteus and when I set the dsPIC clock property to 20Mhz same with the delay in code,proteus gives me "Start hold time violated.Start was at bla bla bla" Stop setup time violated. Last change on SDA was at bla bla bla". In short, when I set both delay and mcu's clock setting the same not in just 20Mhz case, I get the error. I kind of solved this issue setting mcu's clock freq. to 8Mhz while delay is 20Mhz in code but I don't accept this as a solution. Please help me. And I really don't know whethere my clock config or simulator is the problem. That's make me crazy.
    I want to use a crystal.And I want system clock speed to be 20Mhz.

    My #fuses are like this:

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    
    #include <./33FJ32GP204.h> 
    #include <stdlib.h> 
     
    #fuses HS,PR 
    #fuses NOALTI2C1 
    #fuses NODEBUG,NOPUT,NOPROTECT,NOWRT,NOWDT 
    #use delay(crystal=20000000)
    MPLAB X IDE v5.2
    CCS C Compiler as a plugin 3.1

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 4
    Points: 7,773, Level: 21

    Join Date
    Jan 2015
    Posts
    1,090
    Helped
    345 / 345
    Points
    7,773
    Level
    21

    Re: dsPIC33F I2C" Start hold time violated"fuse configs

    General comment: if you use a simulator then you have just added another layer of potential bugs to your project.
    Especially for the sort of thing you are doing, I would recommend that you use the physical device.
    There are *lots* of examples of I2C coding for dsPIC33F (and PIC24 - close enough to the same for this module) on the internet.
    I would not make the assumption that code for a PIC16 will translate well to a dsPIC33.
    Also, if you don;t show us your code then we can't help you with that aspect.
    Finally, never set the DEBUG config bit to anything - let the IDE do that. In fact I note the data sheet has stopped mentioning that bit and simply marks it as 'reserved'.
    Susan



    •   AltAdvertisement

        
       

  3. #3
    Newbie level 2
    Points: 23, Level: 1

    Join Date
    Aug 2019
    Posts
    2
    Helped
    0 / 0
    Points
    23
    Level
    1

    Re: dsPIC33F I2C" Start hold time violated"fuse configs

    Thank you for your response, I have solved the problem. The problem was configuring the i2c. I was using I2C hardware path and again I was declearing the pins inside of #use i2c(..). Then I just #use i2c(master,I2C1) did like this and my problem has gone.



--[[ ]]--