Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] dsPIC33F I2C" Start hold time violated"fuse configs

Status
Not open for further replies.

cmaelot24

Newbie level 2
Joined
Aug 16, 2019
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
20
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
 

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
 

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.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top