Search found 1469 matches

by Jerry Messina
Fri Aug 11, 2023 11:36 am
Forum: User Modules
Topic: Hex file converter
Replies: 12
Views: 5515

Re: Hex file converter

... and for future reference note that not all chips work this way as far as writing partial pages. For example, the Q40 datasheet states: To modify only a portion of a previously programmed page, the contents of the entire page must be read and saved in the buffer RAM prior to the page erase. The R...
by Jerry Messina
Fri Aug 11, 2023 11:21 am
Forum: User Modules
Topic: Hex file converter
Replies: 12
Views: 5515

Re: Hex file converter

Which order do they go when writing to the TABLAT register? The PFM is byte addressable. Write them in the order they are in the hex file, which would be lowbyte, highbyte. The programming app is displaying them as little-endian words, so you see it as highbyte/lowbyte. Regarding the write block an...
by Jerry Messina
Thu Aug 10, 2023 6:14 pm
Forum: User Modules
Topic: Hex file converter
Replies: 12
Views: 5515

Re: Hex file converter

If you want to move the bootloader up into high memory, use '#option ORG_RESET' instead of '#option ORG_PROGRAM' ORG_RESET will move everything for the bootloader project. Then, build your app program as normal. To jump to the bootloader you could use something like: #option BOOTLOADER_SIZE = $1000 ...
by Jerry Messina
Wed Aug 09, 2023 1:54 pm
Forum: User Modules
Topic: Hex file converter
Replies: 12
Views: 5515

Re: Hex file converter

>Any thoughts on my idea of XOR Encryption?

Sounds reasonable to me... I would think that would be enough to deter most folks.
I guess it depends on how secure you want things.
by Jerry Messina
Wed Aug 09, 2023 12:18 pm
Forum: User Modules
Topic: Hex file converter
Replies: 12
Views: 5515

Re: Hex file converter

I only looked at a few bytes, but it looks to me that the only difference is in how the 'unimplemented bits' are displayed. In the hex file, they're '1' (the erased, unprogrammed state), while the app seems to be showing them as '0'. For example, the first byte @ 300000 is 0x8C = 1000 1100. The app ...
by Jerry Messina
Mon Aug 07, 2023 3:01 pm
Forum: User Modules
Topic: Hex file converter
Replies: 12
Views: 5515

Re: Hex file converter

Does the hex file usually have gaps between addresses that need to be recognized and filled with NOPs (FF)? Yes. You will also need to account for addresses that don't fall on a write block address. The CONFIG and any EEPROM initialization data will also be in the hex file, and those are located wa...
by Jerry Messina
Wed Jul 26, 2023 11:29 am
Forum: Compiler
Topic: Using Timer1 to Measure Frequency
Replies: 4
Views: 2532

Re: Using Timer1 to Measure Frequency

Try this, Jon: Device = 18F25K22 Clock = 32 Config 'for K-series device FOSC = HSHP ,'HS oscillator (high power > 16 MHz) PLLCFG = Off ,'Oscillator used directly PRICLKEN = Off ,'Primary clock can be disabled by software FCMEN = Off ,'Fail-Safe Clock Monitor disabled IESO = Off ,'Oscillator Switchov...
by Jerry Messina
Mon Jul 17, 2023 1:10 pm
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

I wasn't trying to discourage you... I just wanted to point out that different devices had different requirements and some things to watch out for. Since you're targeting the Q41 I think your idea will work fine, and there's certainly nothing wrong with adding every extra bit of security when it com...
by Jerry Messina
Sun Jul 16, 2023 4:24 pm
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

So, after playing around a bit with using different unlock sequences, here's what I found... First, this is the recommended asm sequence from the datasheet: MOVLW 0x55 // 5 instruction cycles to end of seq MOVWF EECON2 // START OF SEQ MOVLW 0xAA MOVWF EECON2 BSF EECON1, WR // END OF SEQ The importan...
by Jerry Messina
Sat Jul 15, 2023 2:57 pm
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

My only reservation to write protecting the bootloader area (outside of the bootloader itself) is one day i had envisaged having a bootloader loader I've implemented that feature before, but it still made me nervous every time I used it! Dealing with a corrupt app program download is one thing, but...
by Jerry Messina
Fri Jul 14, 2023 11:01 pm
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

That's interesting. I'll have to play around with the sequences and see where it falls apart. It bet it's just the number of instruction cycles between setting the unlock register values and the WR (or GO bit for the Q41) that you have to worry about. Having the "= 0" stuff in there doesn't hurt any...
by Jerry Messina
Fri Jul 14, 2023 12:30 pm
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

Also, I know we're talking about a Q41 here so the following doesn't really apply when working with program memory, but loading the TBLPTR registers this way: Public Sub EraseBlock (pAddress As TABLEPTR,... will only work for program memory <= 64K, and no other flash sections (if that matters). TABL...
by Jerry Messina
Fri Jul 14, 2023 11:53 am
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

Does that actually work? The datasheets call out a very specific sequence of asm instructions that it says must be followed for the unlock to work. It's interesting that in new datasheets they show it as 'C' code, so there may be some leeway... since they mention that interrupts must be disabled it ...
by Jerry Messina
Thu Jul 13, 2023 12:36 pm
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

Locking and unlocking NVM requires a very special sequence of operations, so I'm not sure I follow you about the "putting it into variables" part. Looking at that MemoryAccess wiki page there appear to be some serious flaws in the WriteItem() code. The TableWrite() sub auto increments the TBLPTR, an...
by Jerry Messina
Thu Jul 13, 2023 11:07 am
Forum: User Modules
Topic: Program Memory Read/Write Q41
Replies: 15
Views: 6005

Re: Program Memory Read/Write Q41

Reading program memory is pretty straight-forward, and that's probably what most people use.
Writing is another story.

I'll take a look at doing an update to that memoryAccess module that's on the wiki.
Is there any feature in particular you're looking for?