• AVR Freaks

Hot!Memory scan (crc) problems with PIC18LF47K42

Author
Valenti Iglesias
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2020/01/20 00:17:29
  • Location: 0
  • Status: offline
2020/12/14 07:07:45 (permalink)
0

Memory scan (crc) problems with PIC18LF47K42

Hi,
I'm trying to implement the crc/scan on a PIC18LF47K42.
First I have implement the hardware's crc without use the memory scanner and it run ok.
But when I try to do with the memory scan it dosen't work.
I think the problem is on the waiting for scanner to finish.
If I wait until BUSY=0 (SCANCON0.0) then loop finishs quickly and allways I get CRC = 0.
If I wait until SCANIF=1 (or until SGO=0) then loop never finishs.
...
// CRC initialize
CRCCON0 = 0x80; // EN=1
CRCCON1 = 0x7F; // DLEN 7; PLEN 15
CRCXORH = poly >> 8;
CRCXORL = poly & 0xFF;
// SCAN initialize
SCANCON0 = 0x82; // EN=1; BURSTMD=1
// Load end address limit
SCANHADRU = 0x3F & (endAddr >> 16);
SCANHADRH = 0xFF & (endAddr >> 8);
SCANHADRL = 0xFF & endAddr;
// Load start address limit
SCANLADRU = 0x3F & (startAddr >> 16);
SCANLADRH = 0xFF & (startAddr >> 8);
SCANLADRL = 0xFF & startAddr;
// Seed = 0
CRCACCH = 0x00;
CRCACCL = 0x00;
// Start Scanner
CRCGO = TRUE; // Start the CRC serial shifter before
SGO = TRUE; // Start the scanner
// Wait loop:
// while( SCANBUSY ); // Then CRC = 0
// while( !SCANIF ); // No exit
while( SCANGO ); // No exit
...
Can anyone help me, please?
PD: I use a CCS compiler, but working directly with the PIC registers defined according to the datasheet.
#1

0 Replies Related Threads

    Jump to:
    © 2021 APG vNext Commercial Version 4.5