Support Forum (EN/FR)

Velleman Projects
It is currently Wed Apr 23, 2014 7:11 pm

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Apr 23, 2007 7:17 am 
Offline
Member
Member

Joined: Fri Apr 20, 2007 7:27 am
Posts: 7
Location: Johannesburg
Summary of Information Velleman K8048 – 12F675 not working

I also ran into the PIC12F & K8048 problems as discussed on this forum. Although I found all the information on the forum, it still took me some time to solve the problem as the information is scattered around in the posts.

1. Should you run into problems programming your PIC12F microprocessors, don’t panic, there might be a way to fix your PIC12F again to work in many projects.

2. The starting point of information is that you should know that when you use the internal oscillator of the PIC12F processors, the PIC12F processors use a value located at 0X3FF for calibrating the accuracy of the internal oscillator. This is called the OSSCAL value. You should also know that when you erase the PIC12F and re-programme it this value might be lost. Without this value the PIC12F may or may not work at all – in most cases the PIC12F will not.

3. When you unpack your PIC12F processors the first thing to do is to read the memory contents of each one and make a note of the value at 0X3FF. This person has engineered and ingenious method of recording the value, follow this link:

http://www.petesworld.demon.co.uk/homeb ... piccal.htm

If you have lost the value, Microchip explains in application note AD250 how to re-calibrate the PIC, however it does not look like a task you can undertake on the dining room table. If you have lost your OSSCAL value, and need high precision timing functions, you will have to purchase another PIC12F. For non critical, hobby and to revive your PIC12F, you might want to try 0xFF/2 = 0x80 as a value. This will get the PIC12F internal 4.0MHz PIC12F oscillator going at a frequency only known to the PIC12F.

4. There are two pieces of software available from Velleman you need to use to programme the PIC12F processors on the K8048 board. The first program is Progpic2.exe and the second is PicProg2006.exe + a patch file (picprog2006_patch_v2026.zip) for this program.

Install these and ensure that the K8048 is working, read the instructions and documentation accompanying the programming software thoroughly.

Progpic2.exe – Does not save and restore the OSSCAL value. But can “Bulk erase” the memory contents.
PicProg2006.exe – Does save and restore the OSSCAL value with the patch installed.

5. To revive your broken PIC12F.
a.) Remove power to the K8048 board; insert the PIC12F and short D7 with a small crocodile clip lead or I have soldered a small toggle switch over D7 and used super glue to glue it onto SK2 (the top of the DB9 connector). Put SW5 into the Prog position, restore power.
b.) Now use Progpic2.exe to “Bulk erase” the memory of the PIC12F. This will work, however you might need to try a couple of times or sometimes you need to remove the power to the board and re-connect it.
c.) If you have the OSSCAL value, you can edit the value after the ORG 0x3FD in the attached .asm program listing and recompile and link into a .hex file and programme your PIC12F still using Propic2.exe, else use the generic value of 0x80.
d.) Should everything work OK, LD1&2 will start flashing.
e.) You can now remove power to the K8048 board and remove the short over D7.

6. You should now switch to the PicProg2006 program to programme your PIC12F, this will ensure that the OSSCAL value is saved and restored during each re-programming PIC12F cycle.


The usual apply; do not use this code if you do not know what you are doing. You can not blame me for anything you break or damage using this code. I the bulk of the code was written by someone else and I don’t know who that person is. I did not retain the information in the header for some reason, so my apologies to the original author.

--- Copy from here and compile in MPLAB Ver 7.51 or Microchip MASM.
Code:
list p=12f675 ; list directive to define processor
#include <p12f675.inc> ; processor specific variable definitions
#define ADCpresent

__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF

; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.

; errorlevel -302 ; suppress banksel warning messages

;===============================================
; Variable Definition
;===============================================
timer1 EQU H'20' ; Used in delay routine
timer2 EQU H'21' ; " " "
pattern EQU H'22' ; Pattern data for LED light show

; Bank Select macro instructions
#define setbank0 bcf STATUS,RP0 ; Sel Bank 0
#define setbank1 bsf STATUS,RP0 ; Sel Bank 1

;**************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program

ORG 0x004 ; interrupt vector location
goto main

; *********************************************
; * delay routine *
; *********************************************
DELAY_ROUTINE movlw D'255' ;54 Generate approx 10mS delay at 4Mhz CLK
movwf timer2
del_loop1 movlw D'255' ;60
movwf timer1
del_loop2 decfsz timer1,F
goto del_loop2
decfsz timer2,F
goto del_loop1
retlw 0
main
; ************************************
; Initialisation and startup code block
; -------------------------------------------------

setbank1 ; switch to register bank 1

clrf GPIO ;Init GPIO
movlw 0xFF
movwf TRISIO

IFDEF OSCCAL ; defined only for 12F629 / 675
call 0x3FF ; read factory oscillator calibration value
movwf OSCCAL ; write to OSCCAL register
; If using a 12F629/675 this value must be present
; and correct, or the code will not function properly
; if it functions at all.
ENDIF

IFDEF ADCpresent
clrf ANSEL ; Set ports for digital mode (12F675 / 12F683 only)
ENDIF

bsf WPU,GP5 ; enable weak-pull-up for SW1 input
movlw 0x07 ; load W=7
movwf CMCON ; disable Comparator on 12F675/627

setbank1
movlw b'00101011'
movwf TRISIO ; Set TRIS register
setbank0

Loop

movlw b'00010100' ;Activate LD2 (GP4) & LD1 (GP2)
movwf GPIO
call DELAY_ROUTINE
movlw b'00000000' ;De-activate LD2 (GP4) & LD1 (GP2)
movwf GPIO
call DELAY_ROUTINE
goto Loop

; If you loose the OSSCAL value in the PIC12F
; this code can be used to put the value back

ORG 0x3FF
; retlw 0x44 ; This value for your PIC12F e.g. 0x44
retlw 0x80 ; Generic value 0xFF/2 = 0x80

END ; directive 'end of program'


I hope this helps.


Last edited by Bear on Fri Aug 17, 2007 2:26 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 3:19 pm 
Offline
User avatar
Velleman Support
Velleman Support

Joined: Mon Dec 11, 2006 12:04 pm
Posts: 37
Location: Belgium
Bear, thanks for this great piece of information, I hope this will help everyone with OSSCAL problems.


Top
 Profile  
 
PostPosted: Fri Aug 17, 2007 1:32 pm 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Bear,

I have read your explanation on how to restore the OSCCAL value for the PIC12f629. I haven't tried it yet. I would just like to ask you a question first. You are talking about shorting D7 and then later you say "remove the short over D13". I know there is no D13 on the K8048 board, but I was wondering if you might not have been referring to R13 instead of D7. Sorry, another thing, as you are probably already aware of the fact that I am an extreme novice (very dumb) at all of this - if you say you short it and you glued the toggle switch over D7 onto SK2. If you are talking about D7, should I basically just connect the positive side of D7 straight onto ground - is that how you would short out the diode? Sorry about all the questions, but I am quite fed up with the PIC's I'm wasting and it seems to be the OSCCAL value I'm loosing everytime.

Kind regards.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 2:31 pm 
Offline
Member
Member

Joined: Fri Apr 20, 2007 7:27 am
Posts: 7
Location: Johannesburg
Hi Charl,

No harm in asking, we all need help sometimes.

You are correct – there is no D13, that was a typo and I have fixed the post. Sorry…

Check the schematic on Page 10 and the Component layout on Page 11 of the K8048 assembly manual to locate D7 - it is a small 1N4148 diode connected to Base and Emitter of Transistor T4.

By shorting D7 - means that a short circuit is created to bridge D7 - the Base of T4 will be connected to GND - this is only done to get the software to erase the PIC. Once the PIC is erased you can re-program and load the OSSCAL value.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 3:17 pm 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Thank you very much for the quick reply. I am going to give it a try and will let you know if it has worked for me.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 8:11 pm 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Hi Bear,

I have tried your solution, but to no avail. It gives me a "NO PIC ON BOARD" error again and I don't know what is wrong now again. This error cropped up previously, but I seem to have solved it. Now it started again. I think I might have messed up the chip, so I'm not saying your solution doesn't work, I think I might have done something else wrong. I will just have to buy a new one again!

Thanks for your help anyway.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 7:01 am 
Offline
Member
Member

Joined: Fri Apr 20, 2007 7:27 am
Posts: 7
Location: Johannesburg
Hi Charl,

There might be nothing wrong with your PIC. I use a lot of 12F PIC's, they are quite resistant to severe handling, contradictory to all the notices in the documentation. I have only blown 4, this was due to connecting a DC motor and relay without the proper back EMV protection, feeding 80V back into a GPIO port by my 2 year old fiddling with my proto board and removing a socketed PIC from a live circuit with a screwdriver and stuff like that! I most cases the PIC still worked, with one I/O blown the PIC just got very hot and the current consumption was high (300-400mA).

There are a number of times when I get the PIC not found message – this is not a signal to buy another chip, it just calls for a different programming strategy.

The most common reasons:

1. Forgetting to put SW5 switch in the PROG position:
2. Not selecting the correct PIC in the programming software.
3. If the input voltage is not high enough – I now supply my K8048 board with stabilized 14-16V DC voltage this is to ensure you get the correct Vpp voltage. I can’t remember the Vpp for the 12F, I think it is +13V, you can check the datasheet.
4. My power plug to DC1 was not making good contact – get the correct one.
5. When using GP1 and GP0 as digital I/O and using the internal oscillator I found that the PIC does not want to “listen” and switch to programming mode when Vpp is supplied to GP3 on Pin 4. (GP3 is input only). When this happens I remove the power via DC1 from the board, put SW5 in PROG and then re-apply the power.

Carl, the K8048 programmer is really a simple design that works very well; you need to be patient and slowly learn the tool (it also took me some time as I took a 20 year break from electronics). Lastly, I hardly ever plug a PIC into the K8048 sockets anymore. I have found by using ICSP, I save a lot of hassle and potential damage to my PICs and the design for ICSP is very simple – just remember to keep those leads short – 5cm.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 9:39 am 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Hi there Bear,

Thanks for all the advice. I will try what you are saying. I think you might be right about the Vpp voltage. I am using a 12V power supply and when I had problems previously, my first thought was that the voltage getting through to the chip is not enough.

why I actually think I messed it up is that I applied about 9V directly to the chip (not thinking). After that it didn't want to work anymore and I couldn't program it anymore. What is funny though is the fact that I have two of them and the other one does the same.

I've gone through a couple of these chips and it seems that with a new one it works fine for a while (probably programming between 10 and 20 times), then it starts with the problem.

I actually bridged out VR1 on the board previously to try and get Vpp up and I don't know if it actually solved the problem but it seemed so at the time. Maybe I should just try another power supply. It should actually be between 12 and 15V.

Another thing, when I usually put the chip in the 8048 board and use the internal clock, then LD9 starts flashing very, very dimly, but then at least I could see there is "life" somewhere. Now it doesn't do it with both the chips I have, which probably points to the board.

I just wish I had a bit more knowledge of electronics. It is very frustrating not to be able to work out what is actually suppose to be happening.

I think I got the same message (NO PIC ON BOARD) when I tried ICSP last time, but I will try it again.

Thank you so much for all your advice, I will definitely try it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 10:30 am 
Offline
Member
Member

Joined: Fri Apr 20, 2007 7:27 am
Posts: 7
Location: Johannesburg
Good luck and keep trying.

I must check LD9 on my board, but I think it does the same as you describe. Thinking about it - the operation of SW-5 is key to ensure easy programming.

I also keep to the following procedure (I have programmed many chips):

1. Connect power to the K8048 board.
2. Place SW-5 in the center position. No 5V or Vpp will be supplied to the PIC.
3. Insert the PIC in the socket.
4. Place SW-5 in PROG and start Picprog2006 on your PC.
5. Select the correct chip.
6. Load the hex file – at this point you will know if you have K8048 problems or not.
7. Once programmed check the OSCCAL value – if it is 3FFF you have PIC trouble and need to be erased and re-programme.
8. Place SW-5 in centre position and remove PIC to target board.

Ps_1 - I have programmed my first PIC12F at least 80 times and it is still working in a RGB mood light today!

Ps_2 – I also don’t use a permanent marker to record the OSCCAL value anymore, it rubs off. I now use a small engraver to make a mark on the IC package above each PIN.


Top
 Profile  
 
PostPosted: Mon Aug 20, 2007 10:18 pm 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Bear,

I don't know anymore. Progpic2 keeps giving me the "NO PIC ON BOARD" error, PicProg2006 gives me an error and when I read the PIC with PicProg2006, it gives me all zeros, including the OSCCAL value. WinPic also has problems programming and it says that there are problems with the OSCCAL value. I should receive my new PIC12F629 tomorrow and then I will see if it works. I just want to know what the use is of reading and noting down the OSCCAL value if you can't restore it?

Well, I suppose I'm just too stupid. Thanks anyway again for all the information. Hopefully the new one will work.


Top
 Profile  
 
PostPosted: Tue Aug 21, 2007 5:49 pm 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Bear,

Me again. My new 12F629 arrived today and I had no problems programming it. My only concern is that when I read the chip the first time with PicProg2006 it gave me a value of 0x3428 for the OSCCAL value and after I programmed it, I read it again and then it gave me a value of 0x3FFF. I can still program it though.

LD9 also flashes again very dimly when I insert the new PIC. Might the problem be that I disable the Code Protection bit and then I erase the OSCCAL value?

I think I mess it up in my circuitry, as I said about the 9V I connected to it. I'm determined to solve the problem though. Maybe once I have more knowledge I will be able to solve it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 10:21 am 
Offline
Member
Member

Joined: Fri Apr 20, 2007 7:27 am
Posts: 7
Location: Johannesburg
Hi Charl - Was busy with another project and did not have enough time in the day to check this forum. It sounds more like you have a connectivity problem between your PC and the K8048. Check your COM port setup with Hyperterminal and a Loopback adapter first. There are many circuits available on the internet - just Google "DB-9 Loopback adapter", and solder one up with thin wire and a DB-9 plug. Also make sure your cable is as per Page 9 in the manual. I actually use a console cable of some router (maybe CISCO), plug the Loopback at the end of this cable.

An OSCCAL value of 0x3FF at the end of the programming session is a bad indicator! This is what you get when you programming attempt have failed and where you need to have the value noted down.

PS: I have actually logged-in to tell you that, yes my LD-9 also does the faint flasshing when I insert a 12F675 for programming and SW-5 is in the centre position.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 10:28 am 
Offline
Member
Member

Joined: Fri Apr 20, 2007 7:27 am
Posts: 7
Location: Johannesburg
Charl - sorry I did not see and read your one post. At least you could read the PIC memory. Still check your COM port and cable. Use the sample asm program and then place the OSCCAL value of ("value of 0x3428 for the OSCCAL") back into the PIC. Keep going.


Top
 Profile  
 
 Post subject: 12F629 not working
PostPosted: Wed Sep 05, 2007 12:28 pm 
Offline
Member
Member

Joined: Tue Jul 10, 2007 1:15 pm
Posts: 13
Location: United Kingdom
Hi Bear,

No problem. I had to put my project on hold for a while. I just wanted to let you know that the new PIC also gave me a problem with the OSCCAL later and then I tried that procedure of yours and it worked perfectly. I'll probably be able to return to it again once I've forgotten everything! I got my stepper motor to turn though - big breaktrough for me!

See you again.


Top
 Profile  
 
 Post subject: Hi
PostPosted: Fri Dec 14, 2007 12:06 am 
Offline
Member
Member

Joined: Thu Dec 13, 2007 11:35 pm
Posts: 5
I have a similary problem wtih the k8048'1.
I can read pic, I can write Pic but the Osccal values is always 3FFF when I write in a Pic.

I read the post of this topic but I don't sure to have find the solution to my problem (I'm a neewby in electronic :? )

My procedure :
- I dowload a .hex file for 12F629 Pic from a website.
- I put a new 12F629 Pic in the K8048.
- I read the Osccal values of the new 12F629 pic with Picprog2006 2.2.0.0, In my test : 3448
- I change value in the .hex file with Winpic800 and save the .hex file.
- I execute Picprog2006 and open the .hex file with the good Osccal value
- I write all in the Pic.
- > The program is writing correctly but my Osscal value is always 3FFF whereas the value osscal in the .hex value was 3448.

When I erase Pic, again and again with Picprog2006 I have always the 3FFF in Osccal value. Is it possible to use K8048 with Winpic or Icprog ? If yes what is the option to chose in soft ?

Can you help me ?

PS : my alimentation on SK2 is 12V 2A .
My serial cable has all pin connected but on the schema, the pin 1,2 and 6 are not connected, it is a problem ?

Thx.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group