Searching \ for '[PIC] C30 Problems' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'C30 Problems'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] C30 Problems'
2006\06\07@105140 by Thomas C. Sefranek

face picon face
Where do I set the destination device (UART1, UART2) for printf?

I can't even find the source for stdio.h

Tom

 *
 |  __O    Thomas C. Sefranek  spam_OUTtcsTakeThisOuTspamcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org



2006\06\07@135003 by WH Tan

flavicon
face

> Where do I set the destination device (UART1, UART2) for printf?
>
> I can't even find the source for stdio.h


Hi Tom,

The stdio library will direct its output to a fuction call write()  (forget
its prototype, but I believe it's explained in the library manual).  If you
can find the source (I'm not sure if it included in the C30 package) you'll
find that it will output to UART1.


Best regards,

WH Tan

2006\06\07@141001 by Phil Keller

flavicon
face
When I asked customer support a couple of weeks ago:
"
Dear customer,
Basically STDIO printf will ultimately call the write( ) function which
you can refer to its source code in your C30 installation directory i.e
...\MPLAB C30\src\pic30\write.c. You can redirect its stdout to other
peripherals based on the write.c source code.
Or you also can write your own write.c code to direct the stdout to your
wanted periphers which will override the original write function since
it is defined as 'weak' attribute.

"

Phil

WH Tan wrote:

{Quote hidden}

--
--------------------------------
Long ago when men cursed and beat the
ground with sticks,  it was called witchcraft..

Today, it's called golf.


2006\06\07@142148 by Thomas C. Sefranek

face picon face
Thanks WH Tan,

DO you have any idea of how I change the output to UART2?

Tom

 *
 |  __O    Thomas C. Sefranek  .....tcsKILLspamspam@spam@cmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

{Original Message removed}

2006\06\07@143831 by WH Tan

flavicon
face

> Thanks WH Tan,
>
> DO you have any idea of how I change the output to UART2?
>
> Tom

That should be easy...

Just copy the original source for the function write(), paste it to your
project and make the change accordingly.

As Phil has pointed out, you should be able to find the source.


Best regards,

WH Tan

2006\06\07@161311 by Thomas C. Sefranek

face picon face
Unfortunately, I already tried that, it doesn't compile.
Apparently you have to compile it within their build environment.
Which I have no idea how to do.

 *
 |  __O    Thomas C. Sefranek  tcsspamKILLspamcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

{Original Message removed}

2006\06\07@172941 by WH Tan

flavicon
face

> Unfortunately, I already tried that, it doesn't compile.
> Apparently you have to compile it within their build environment.
> Which I have no idea how to do.
>


Aha, I just recall you have some linker problem recently. If I recall
correctly you have mentioned PIC24, right?  Perhaps the source is for
dsPIC30, and not for PIC24, and that's why the peripheral is currently not
supported for PIC24/dsPIC33...  Sorry for overlooking that matter.

But still I think you can implement that by your own.  Sorry, I can't help
on this as I haven't done any program for PIC24.


Best regards,

WH Tan

2006\06\07@184840 by Tom Sefranek

face picon face
WH Tan wrote:

>>Unfortunately, I already tried that, it doesn't compile.
>>Apparently you have to compile it within their build environment.
>>Which I have no idea how to do.
>>    
>>
>Aha, I just recall you have some linker problem recently. If I recall
>correctly you have mentioned PIC24, right?  Perhaps the source is for
>dsPIC30, and not for PIC24, and that's why the peripheral is currently not
>supported for PIC24/dsPIC33...  Sorry for overlooking that matter.
>
>But still I think you can implement that by your own.  Sorry, I can't help
>on this as I haven't done any program for PIC24.
>  
>
No, after reading that there is NO peripheral support for the PIC24 series,
I switched my code for a pin identical dsPIC30F6011.
(Unfortunately it only has 6K of RAM.)
If I compile "my"  UART2  write(), I get errors about all kinds of
undeclared stuff.
If you are interested, tomorrow, I can send my source code, it's pretty
small.

>Best regards,
>
>WH Tan
>
Tom

--
 *
 |  __O    Thomas C. Sefranek   .....WA1RHPKILLspamspam.....ARRL.net
 |_-\<,_   Amateur Radio Operator: WA1RHP  
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2006\06\07@194623 by WH Tan

picon face
2006/6/8, Tom Sefranek <EraseMEtcsspam_OUTspamTakeThisOuTcmcorp.com>:
> No, after reading that there is NO peripheral support for the PIC24 series,
> I switched my code for a pin identical dsPIC30F6011.
> (Unfortunately it only has 6K of RAM.)
> If I compile "my"  UART2  write(), I get errors about all kinds of
> undeclared stuff.
> If you are interested, tomorrow, I can send my source code, it's pretty
> small.
>


OK.  Can you try this:

Create a new write.c file, and put the following into it.  Don't
forget to add it to your project tree.





#include <p30fxxxx.h>
#include <stdio.h>

#define        SPEN        0x8000u
#define        TXEN        0x0400u
#define        TRMT        0x0100u
#define        TXBF        0x0200u
#define        RCDA        0x0001u

int write(int handle, void *buffer, unsigned int len)
{
       int i;
       
       switch (handle)
       {
       case 0:
       case 1:
       case 2:
               if ((U2MODE & SPEN) == 0)
               {
                       U2BRG = 0;
                       U2MODE |= SPEN;
               }
               if ((U2STA & TXEN) == 0)
               {
                       U2STA |= TXEN;
               }
               for (i = len; i; --i)
               {
                       while (U2STA & TXBF);
                       U2TXREG = *(char*)buffer++;
               }
               break;
       default:
               break;
       }
       return(len);
}






Best regards,

--
WH Tan

2006\06\08@070230 by Tom Sefranek

face picon face
I believe this is EXACTLY what I cloned for my code.
But I'll check when I get to work.

WH Tan wrote:

{Quote hidden}

--
 *
 |  __O    Thomas C. Sefranek   @spam@WA1RHPKILLspamspamARRL.net
 |_-\<,_   Amateur Radio Operator: WA1RHP  
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2006\06\17@014009 by WH Tan

picon face
2006/6/8, Tom Sefranek wrote:
> I believe this is EXACTLY what I cloned for my code.
> But I'll check when I get to work.

Hi Tom,

How thing goes?



{Quote hidden}

Just a point need to clarify for above example:

You might want to move the default: break;  part to join up with cases
1, 2 and 3...  Note that in that example, if the program execution
reachs that point, no output is actually processed, BUT the function
will return (len) anyway.

Or you might want to write your own implementation at all.




Best wishes,

--
WH Tan


'[PIC] C30 Problems'
2006\08\02@134528 by Thomas C. Sefranek
face picon face
More fun with C30 for the PIC24s...


I can not get the compiler to pay ANY attention to uart.h

I added it to the MPLAB include path $(incdir) and even added it explicitly
in the MPLAB includes folder as a file.

If I invoke definitions unique to PIC 24 UART (Defined in uart.h) the
compiler complains they are undefined.


Source file line:
       USART2_STA_Value = UART_INT_TX & UART_IrDA_POL_INV_ZERO &
UART_SYNC_BREAK_DISABLED & UART_TX_ENABLE & UART_INT_RX_3_4_FUL &
UART_ADR_DETECT_DIS & UART_RX_OVERRUN_CLEAR;


Compiler results:

Inits.c: In function `inits':

Inits.c:140: error: `UART_IrDA_POL_INV_ZERO' undeclared (first use in this
function)

Inits.c:140: error: (Each undeclared identifier is reported only once

Inits.c:140: error: for each function it appears in.)

Inits.c:140: error: `UART_SYNC_BREAK_DISABLED' undeclared (first use in this
function)

Halting build on first failure as requested.


Programming in C are good... with asprin.

Tom

 *
 |  __O    Thomas C. Sefranek  KILLspamWA1RHPKILLspamspamARRL.NET
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org



2006\08\02@152605 by WH Tan

picon face
2006/8/3, Thomas C. Sefranek wrote:
{Quote hidden}

Hello Tom,

That sounds like you have some variable or define at other module than
inits.c , and you didn't extern or include it in inits.c.  It is late
here, and I have to go now. Maybe I will get back to you later...


Best regards,

--
WH Tan

2006\08\02@161752 by William Chops Westfield

face picon face
>>
>> I can not get the compiler to pay ANY attention to uart.h
>>
>> I added it to the MPLAB include path $(incdir) and even
>> added it explicitly in the MPLAB includes folder as a file.
>>
>> If I invoke definitions unique to PIC 24 UART (Defined
>> in uart.h) the compiler complains they are undefined.
>>

You DO have the explicit "#include <uart.h>" in your sourcecode,
right?  Usually the make-like paths just tell the compiler where
to look for things that are included; they don't actually cause
them to be included (Perhaps MPLAB does something different?  But
it would be a weird and bad thing to be that contrary to standard
C practices, IMO.)

The other possibility is that your uart.h is eclipsed by another
uart.h earlier in the search path that doesn't include the definitions
that you want.

BillW

2006\08\02@170554 by Thomas C. Sefranek
face picon face
Hurrah and a tiger for you Bill.

I had an include uart.h, but ofcourse the compiler uses the old one,
Because the new stuff is in a different directory.

I guess I better copy ALL of the new stuff for the peripherals to the
"old" directory.

Thanks Again
Tom

 *
 |  __O    Thomas C. Sefranek  spamBeGoneWA1RHPspamBeGonespamARRL.NET
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

{Original Message removed}

2006\08\03@012110 by William Chops Westfield

face picon face
On Aug 2, 2006, at 2:07 PM, Thomas C. Sefranek wrote:

> I had an include uart.h, but ofcourse the compiler uses the old one,
> Because the new stuff is in a different directory.
>
This is why cisco code contains things like
COMP_INCLUDE(IOS, KERNEL, uart.h)
and
#include "../kerberos/cfshost/cisco/des.h"

instead of relying on search paths.  Some names are just
TOO likely to not be unique across people's imaginations.

BillW

2006\08\03@100211 by WH Tan

picon face
2006/8/3, Thomas C. Sefranek wrote:
> Hurrah and a tiger for you Bill.
>
> I had an include uart.h, but ofcourse the compiler uses the old one,
> Because the new stuff is in a different directory.
>
> I guess I better copy ALL of the new stuff for the peripherals to the
> "old" directory.
>

I'm curious Tom.  Can you show your inits.c?  What you have included
in this module?  A 'new' uart.h?

I am guessing what you're doing:  You're doing some IR stuff with
UART2 port, right?  And you have made some change to C30 uart.h ?  If
I were you, I will let uart.h unchanged as it was.  I will then make a
new header file with a different name and put all new stuff inside
this header file.  Then I will have inside inits.c

#include <uart.h>    // include the original C30 one
#include "new_header.h"    // include all new stuff


Best regards,

--
WH Tan

2006\08\03@140809 by Thomas C. Sefranek

face picon face
Hi Tan,

The "New" uart.h comes from Microchip for the additional support for the
PIC24 series.
(Lots of new register bits needed to be defined, etc.)

Tom

 *
 |  __O    Thomas C. Sefranek  TakeThisOuTWA1RHPEraseMEspamspam_OUTARRL.NET
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

{Original Message removed}

2006\08\03@142612 by WH Tan

picon face
2006/8/4, Thomas C. Sefranek wrote:
> Hi Tan,
>
> The "New" uart.h comes from Microchip for the additional support for the
> PIC24 series.
> (Lots of new register bits needed to be defined, etc.)
>
> Tom
>
>  *
>  |  __O    Thomas C. Sefranek  RemoveMEWA1RHPspamTakeThisOuTARRL.NET
>  |_-\<,_   Amateur Radio Operator: WA1RHP
>  (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4
>
> ARRL Instructor, Technical Specialist, VE Contact.
> hamradio.cmcorp.com/inventory/Inventory.html
> http://www.harvardrepeater.org
>
> {Original Message removed}

2006\08\03@163902 by Thomas C. Sefranek

face picon face


OH yeah, just recalled that peripheral lib is not supported at the
moment!  Did they tell you when the lib will be supported?

No, All they could do was send me a BETA version.


Best regards,

--
WH Tan
--

 *
 |  __O    Thomas C. Sefranek  WA1RHPEraseMEspam.....ARRL.NET
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41MHz PL74.4

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org


2006\08\20@101509 by WH Tan

picon face
Tom,

Can you get printf working for PIC24's UART2?

I just tested my Explorer 16 demo board (which has been sleeping for
almost 2 month), and I seem to be able to output something.  If you're
interested, please let me know.


Best regards,

--
WH Tan

2006\08\20@133032 by Tom Sefranek

face picon face
I got it to compile, but I can't get the chip into debug with  MPLAB.
So I don't have any "real" results.
Thank You for keeping me in mind.


WH Tan wrote:

{Quote hidden}

Tom

--
 *
 |  __O    Thomas C. Sefranek   EraseMEWA1RHPspamARRL.net
 |_-\<,_   Amateur Radio Operator: WA1RHP  
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org


2006\08\20@143640 by WH Tan

picon face
2006/8/21, Tom Sefranek wrote:

> I got it to compile, but I can't get the chip into debug with  MPLAB.


Tom,

Do you mean debug in SIM30? My version didn't output to SIM too.

Or do you mean ICD2?


--
WH Tan

2006\08\20@161100 by Tom Sefranek

face picon face
Sorry, it is not able to debug with the ICD2.
I posted the error text lat week.

WH Tan wrote:

{Quote hidden}

--
 *
 |  __O    Thomas C. Sefranek   RemoveMEWA1RHPEraseMEspamEraseMEARRL.net
 |_-\<,_   Amateur Radio Operator: WA1RHP  
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

2006\08\20@173813 by WH Tan

picon face
2006/8/21, Tom Sefranek wrote:

> I posted the error text lat week.

Apparently I have missed that message.  Anyway I read it now in my
gmail mailbox.  I love gmail... it's my PIC mail archive now and I
never deleted a PICList message since I used it :)

The device I'm working with is PIC24FJ128GA010 (the PIM on Exp16
board, rev 0x3001 reported by ICD2).  The ICD2 debugging seems to be
working just fine. I can break and view the memory content etc.  From
you description of the other message posted, sounds like you haven't
used the _CONFIG macro to set the configuration settings. Just for
your reference, I have the following in my C file contain the main()
routine:

// Setup configuration bits
_CONFIG1(JTAGEN_OFF &        // JTAG Disabled
       GCP_OFF &        // Code Protection Disabled
       GWRP_OFF &        // Write Protection Disabled
       COE_OFF &        // Clip-on Emulation Disabled
       FWDTEN_OFF &        // Watchdog Timer Disabled
       ICS_PGx2)        // ICD2 pins select: EMUC/EMUD share PGC2/PGD2

_CONFIG2(FCKSM_CSDCMD &        // Clock switching and clock monitor: Only
clock switching enabled
       OSCIOFNC_ON &        // OSCO/RC15 function: RC15
       POSCMOD_HS &        // Oscillator Selection: HS oscillator
       FNOSC_PRI)        // Primary oscillator (XT, HS, EC)

Your processor might be a bit different, but you can have a clue by
looking into the processor header file, which you can find in your C30
folder.


Well I'm searching for the equivalent alphabet revision representation
for PIC24FJ128GA010 . You know that is the most confuse issue that
Microchip has ever made - ICD2 report something like rev 0x3001 while
their errata sheet has a title something like rev A1, A2...etc.  Then
sometime the short description of ICD2 report was missing from the
errate sheet. Still undergo testing of my GetSiliconRevision()
routine...

I hope you can find a solution soon.


Best wishes,

--
WH Tan

2006\08\20@222611 by John Chung

picon face
WH Tan,

    I am trying to program the PIC24FJ128GA010  on
the Explorer 16. I still have a problem detecting the
MCU using my ICD2. Do you have any hints? BTW I have
set the switch to PIM and the jumper to PIC24. Still
not success. Xiao Fan did mention about actually
interfacing with the PIM directly. Still don't have
the chance to get the correct cables btw ICD2 and the
PIM. I still haven't given up talking to the Explorer
16 directly.

Thanks
John



--- WH Tan <RemoveMEwhsiung.myspam_OUTspamKILLspamgmail.com> wrote:

{Quote hidden}

> --

2006\08\21@010507 by WH Tan

picon face
2006/8/21, John Chung wrote:

>     I am trying to program the PIC24FJ128GA010  on
> the Explorer 16. I still have a problem detecting the
> MCU using my ICD2.

Sounds like a defective board!?

But a few questions for you:

1) Did the pre-programmed demo application work?

2) Have you selected the correct device in MPLAB? And the ICD2 OS was
downloaded?

3) What type of connection you used for ICD?  USB or COM?  Did ICD2
detect other device or board?


Best regards,

--
WH Tan

2006\08\21@021222 by John Chung

picon face
My answers are below.

--- WH Tan <RemoveMEwhsiung.myTakeThisOuTspamspamgmail.com> wrote:

{Quote hidden}

 Yes.

> 2) Have you selected the correct device in MPLAB?
> And the ICD2 OS was
> downloaded?

 I did choose PIC24FJ128GA010 as the device.

>
> 3) What type of connection you used for ICD?  USB or
> COM?  Did ICD2
> detect other device or board?

 ICD2 was using USB. BTW I did use the same ICD2 to
detect my PIC16F873. No problem with that PIC. ICD2
did not detect any other device. the device Id return
from the PIC24 was 0. The power line were okay. Maybe
I need to do a continuity test btw the RJ-12 and the
chip itself......

 The problem is that the demo works but the
programming does not? Any hints?

Thanks,
John
>
>
> Best regards,
>
> --
> WH Tan
> --

2006\08\21@033117 by WH Tan

picon face
2006/8/21, John Chung wrote:


> > 3) What type of connection you used for ICD?  USB or
> > COM?  Did ICD2
> > detect other device or board?
>
>  ICD2 was using USB. BTW I did use the same ICD2 to
> detect my PIC16F873. No problem with that PIC. ICD2
> did not detect any other device. the device Id return
> from the PIC24 was 0. The power line were okay. Maybe
> I need to do a continuity test btw the RJ-12 and the
> chip itself......

But did the OS got downloaded?  I check my version in the setting
dialogue box, it says:

MPLAB ICD2 Version: 07.40.00.18
Firmware Type: 33F  ( Funny I'm working with PIC24)
Firmware version: 02.00.06.00

and my MPLAB version is 7.41.

And apart from connection check, you might want to confirm the power
supply: both the reading reported in MPLAB and measured by a true DMM.

In MPLAB IDE, I got:

Target Vdd: 3.24V
Target Vpp: 3.20V (I think becasue I was not performing any
programming at the moment)
MPLAB ICD2 Vpp: 14.06V


Measured by DMM:

The Red colour +5V test 'ring' : 4.99V
The Red coluor +3.3V test ring: 3.29V

I also probe several capacitor on the PIM, from what I see here there
are C7, C2, C3, C4, C8, C1.  All of them give 3.29V at one terminal,
and close to 0V at another terminal.

The only exceptions are C6 and C5: I haven't examined closely yet what
are their purpose but they sound like part of the on-chip regulator,
which give 2.5V.


Best wishes,

--
WH Tan

2006\08\21@035641 by John Chung

picon face
My answers are below.

--- WH Tan <EraseMEwhsiung.myspamspamspamBeGonegmail.com> wrote:

> 2006/8/21, John Chung wrote:
>
>
>
> MPLAB ICD2 Version: 07.40.00.18
> Firmware Type: 33F  ( Funny I'm working with PIC24)
 I remember this. It was in my firmware that was
downloaded into the ICD2.

{Quote hidden}

 I got zeros for this.........

> MPLAB ICD2 Vpp: 14.06V
 I got this correct! ...........

>
>
> Measured by DMM:
>
> The Red colour +5V test 'ring' : 4.99V
> The Red coluor +3.3V test ring: 3.29V
>

 Now for real voltages :) I will go home and test
this again.  I'll report my findings tomorrow.

Thanks,
John


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

2006\08\21@093327 by John Chung

picon face
Thanks WH Tan and Xiao Fan. Finally got it working.
The continuity test did the trick. The pins in the
RJ-12 were bend in quite badly...... So NO Vdd from
the Explorer 16!!!!

Thanks guys,
John Chung

--- WH Tan <RemoveMEwhsiung.myKILLspamspamgmail.com> wrote:

{Quote hidden}

> --

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...