Not Able to Program My Micro Controller Again

mathiyadav

Starting Member

  • Total Posts : 57
  • Reward points : 0
  • Joined: 2021/09/16 22:19:01
  • Location: 0
  • Status: offline

How to reset the Microcontroller intentionally

Im using dspic33ck256mp508 Dev board....i need to manually reset the microcontroller...if some condition get fail...whatsoever one accept any idea regarding this...?

JPortici

Super Member

  • Total Posts : 1698
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: montegrappa
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/22 23:17:28 (permalink)

Manually: There is a reset button on the devboard, information technology's clearly labeled either RESET or MCLR, but the devboard transmission has this covered.

mathiyadav

Starting Member

  • Total Posts : 57
  • Reward points : 0
  • Joined: 2021/09/16 22:xix:01
  • Location: 0
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/22 23:29:16 (permalink)

i need a software reset...Non Hardware reset....im my programme i have a i2c module....in any case i2c failed to read...I need to reset the device using teaching......

rpg7

Super Member

  • Total Posts : 1499
  • Reward points : 0
  • Joined: 2003/xi/07 12:47:35
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/22 23:33:33 (permalink)

mathiyadav
i need a software reset...Non Hardware reset....im my program i accept a i2c module....in whatever example i2c failed to read...I need to reset the device using instruction......

Let the WDT timeout.

ric

Super Fellow member

  • Total Posts : 34319
  • Reward points : 0
  • Joined: 2003/xi/07 12:41:26
  • Location: Commonwealth of australia, Melbourne
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/22 23:57:07 (permalink)

mathiyadav
i need a software reset...Non Hardware reset....im my program i take a i2c module....in any case i2c failed to read...I need to reset the device using instruction......

If this is just to get I2C working again, disable the I2C peripheral, bladder the GPIO pivot driving SDA (i.e. make it an input)
and toggle the SCL pin ix times at about 100 kHz.
The reenable the I2C peripheral.

I too post at: PicForum
To get a useful answer, always state which Movie y'all are using!

JPortici

Super Member

  • Total Posts : 1698
  • Advantage points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: montegrappa
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 00:30:34 (permalink)

Okay, then adjacent time retrieve really hard about what you want to practice, take the time to write it down clearly (not every bit you did.........y'all know puctuation and stuff.....which is really abrasive..........)

 I'll assume that yous want to reset the flake for some reason
Read the datasheet, the RESET chapter. Information technology tells you the various way y'all can reset the chip and how to observe what acquired the reset.
POR (Power On Reset) of course
MCLR (Primary clear held depression and then released) naturally
RESET education (Software reset) obviously
WDT Timeout
DMT Timeout

 At any signal in your code yous tin can add this line
asm("RESET");
and information technology volition perform a software reset

 Or you tin can have the watchdog/dmt expire and issue a reset

 Or yous can have an external chip that acts as a watchdog, connect it to the MCRL line and if it thinks your device is not responding or operating correctly generate a pulse on MCLR

 However, ric mentions another thread in which you lot claim y'all have a trouble with I2C slaves.
If you have already started a thread for this problem, why start another?

mathiyadav

Starting Fellow member

  • Total Posts : 57
  • Reward points : 0
  • Joined: 2021/09/16 22:xix:01
  • Location: 0
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 03:51:44 (permalink)

Thanks For your valuable feedback on my queries...Adjacent time onward i rectify my mistake on Punctuation and and then on...
As you said,I fully gone through the Reset FRM sheet...Only in that location they take mentioned a RESET teaching will cause the device reset....Simply They did not mention how to declare the Reset instruction...and then that why i got ambiguity as i put but  write RESET; in my code,only it throw me a compile time error.Now my question is straight forrad..
How y'all people all know the correct usage of RESET instruction.

  To know that types of tricky what document should i become For..if tell that will be very useful for me..!
Thank you

mathiyadav

Starting Member

  • Total Posts : 57
  • Reward points : 0
  • Joined: 2021/09/16 22:19:01
  • Location: 0
  • Condition: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 04:01:33 (permalink)

Hello Ric...!
i using dspic33ck256mp508 development  lath with MCC generated code.FCY=4MHZ and FOSC=8MHZ
i have go rid out of so many issue by your awesome ideas and suggestion..only in i2c im not able to recover the bus from getting neglect,even generated the nine clock pulse subsequently disable i2c peripheral it is non working...

  This is the snippet i used for recover the i2c coach from any fail.is this correct method to recover,if not delight point out my mistakes

 #define SCL_TRIS_AFE TRISBbits.TRISB2
#define SDA_TRIS_AFE TRISBbits.TRISB7
#define SCL_AFE LATBbits.LATB2
#ascertain SDA_AFE LATBbits.LATB7
void I2C_Peripheral_Reset_AFE(void)
{
IEC8bits.MI2C3IE = 0;
    I2C3CONLbits.I2CEN=0;
    SDA_TRIS_AFE = 1;
    SCL_TRIS_AFE = 0;
    int i;
    practice
    {
        for(i=0;i<9;i++)
        {
            SCL_AFE = 0;
            __delay_us(five);
            SCL_AFE = one;
             __delay_us(5);
        }

            }while(!(_RB7));
    I2C3CONLbits.I2CEN=1;
    IEC8bits.MI2C3IE = i;
    I2C3_Initialize();
 }

ric

Super Member

  • Total Posts : 34319
  • Advantage points : 0
  • Joined: 2003/eleven/07 12:41:26
  • Location: Commonwealth of australia, Melbourne
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 04:18:09 (permalink)

Have yous tried watching the SDA and SCL signals with a telescopic to see what they are actually doing?

I also postal service at: PicForum
To get a useful answer, always state which Film you are using!

du00000001

Simply Some Fellow member

  • Full Posts : 4660
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Frg
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 04:22:nineteen (permalink)

mathiyadav
Cheers For your valuable feedback on my queries...Next fourth dimension onward i rectify my error on Punctuation then on...
As you lot said,I fully gone through the Reset FRM canvass...Only there they have mentioned a RESET instruction will cause the device reset....But They did non mention how to declare the Reset instruction...so that why i got ambivalence as i put but  write RESET; in my code,merely information technology throw me a compile time fault.Now my question is straight forrad..
How you lot people all know the correct usage of RESET educational activity.

  To know that types of tricky what document should i go For..if tell that volition exist very useful for me..!
Thank You

Did yous ever consider to consult the compiler's documentation?
Might be there's even some macro definition available to avoid explicit inline assembly...

PEBKAC / EBKAC / POBCAK / PICNIC (somewhen see en.wikipedia.org)

ric

Super Member

  • Total Posts : 34319
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 04:31:06 (permalink)

The manual says that just exiting from the main() role volition cause a reset.
However, if the trouble is a stuck I2C bus, a PIC reset probably won't aid.

I as well mail at: PicForum
To get a useful answer, always state which PIC you lot are using!

mathiyadav

Starting Fellow member

  • Total Posts : 57
  • Advantage points : 0
  • Joined: 2021/09/16 22:19:01
  • Location: 0
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 04:56:08 (permalink)

Cheers for your concern ric...!

 I'1000 having a Battery Management System  Project,in that I'1000 using i2c slave AFE to read the cell voltage of a battery.Everything works fine for most fourth dimension but in real field ,master  controller fails to read the voltage.
so i need to avoid that scenario.so i did manual software autobus clear logic past generate nine clock pulse every bit you said but it is non recovered from the fault..so what i did is to manually reproduce the condition,i intentionally brusk the SCL to GND i2c communication fails afterwards my i2c_reset_func();will exist executed to generate the nine clock but it fails.
Then i  shorted the SDA to GND again fails,but if i  pressed the Reset Button on the board(i.e...MCLR pin ) i2c communication able to read the pack and every things works fine....so i seeking a software solution for the reset ....
Thank You..!

du00000001

Just Some Member

  • Total Posts : 4660
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 05:27:31 (permalink)

mathiyadav
Thanks for your concern ric...!

 I'1000 having a Battery Management System  Project,in that I'm using i2c slave AFE to read the prison cell voltage of a bombardment.Everything works fine for near time simply in existent field ,master  controller fails to read the voltage.
so i need to avoid that scenario.so i did manual software bus clear logic past generate nine clock pulse equally you said simply it is not recovered from the fault..and so what i did is to manually reproduce the condition,i intentionally curt the SCL to GND i2c communication fails subsequently my i2c_reset_func();will be executed to generate the nine clock merely information technology fails.
Then i  shorted the SDA to GND over again fails,but if i  pressed the Reset Push on the lath(i.e...MCLR pin ) i2c communication able to read the pack and every things works fine....so i seeking a software solution for the reset ....
Thanks..!

Ameliorate debug your software - though the reset is the intriguing "fast path".
IIRC 9 clock pulses are the maximum simply less pulses might exist required in the private example. So you have to check for the status signalling that the bus is no longer bricked.
Are you sure that yous don't loose some pin configuration unintentionally?

PEBKAC / EBKAC / POBCAK / PICNIC (somewhen see en.wikipedia.org)

Jerry Messina

Super Member

  • Full Posts : 1134
  • Reward points : 0
  • Joined: 2003/11/07 12:35:12
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 07:43:25 (permalink)

This is the snippet i used for recover the i2c jitney from whatsoever fail

After sending the 9 clocks you should generate a STOP.
That should put the slave into an idle land.

NKurzman

A Guy on the Net

  • Total Posts : 19692
  • Reward points : 0
  • Joined: 2008/01/sixteen 19:33:48
  • Location: 0
  • Status: offline

Re: How to reset the Microcontroller intentionally 2022/02/23 08:43:47 (permalink)

A battery monitoring system?
Is the Fleck yous are talking to SMBus?
It should timeout in 35milliseconds.
Hold the clock line depression for greater than 35 ms it should forcefulness a reset.

Besides annotation if yous're having communications this is there's a minimum clock speed for SM bus.
And a consummate communication must be finished within the 35 ms.

biggerstaffnothas01.blogspot.com

Source: https://www.microchip.com/forums/m1200283.aspx

0 Response to "Not Able to Program My Micro Controller Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel