Searching \ for '[PIC] Success report: C, bare dsPIC and Linux free' 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/ios.htm?key=spi
Search entire site for: 'Success report: C, bare dsPIC and Linux free'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Success report: C, bare dsPIC and Linux free'
2005\05\19@000716 by Chen Xiao Fan

face
flavicon
face
Now I wish someone can make ICD2 work under Linux
(even only as a programmer).

Xiaofan

-----Original Message-----
From: spam_OUTforumsTakeThisOuTspammicrochip.com [.....forumsKILLspamspam@spam@microchip.com]
Sent: Tuesday, May 17, 2005 5:26 AM
Subject: This is an email notification from forum.microchip.com.

A new post has been made on May 16, 2005 2:26:09 PM .

Category: 16 bit Digital Signal controllers
Forum: dsPIC30F Topics
http://forum.microchip.com/fb.asp?m=94243

Details of this message include:


hanzl

 Success report: C, bare dsPIC and Linux free tools  

Using C, bare dsPIC in breadboard, ad-hoc made programmer and just
opensource free tools, I have my LED blinking

This game is for bigger nasty children so think twice before following me.
But if you think that at least trying what is it worth to do something
zero-up, here we go:

1) C30 is ported gcc, you can compile your mostly complete free toolchain or
use these .deb or .rpm files:
http://noel.feld.cvut.cz/dspic/

2) Minimalistic C file working around missing libraries looks like this:

#define ASM(X) __asm__ volatile( X )
#define STRING(X) #X /* X macro-expanded before being quoted */
#define BCLR(adr,bit) ASM( "bclr " STRING(adr) ", #" STRING(bit) )
#define BSET(adr,bit) ASM( "bset " STRING(adr) ", #" STRING(bit) )

#define TRISD 0x2D2
#define PORTD 0x2D4
#define LATD  0x2D6

__attribute__((section("__FOSC.sec,x"))) int _FOSC = (0x810B);

_reset(){
main();
}

delay(){
volatile int x = 0;
for( x=30002; x>0; x-- ){
}
}

main(){
BCLR( TRISD, 1 ); /* RD1 is output */
while( 1 ){
  BSET( LATD, 1 );  /* RD1 high */
  delay();
  BCLR( LATD, 1 );  /* RD1 low */
  delay();
}
};


3) Compile like this:

 pic30-elf-gcc -nostdlib dspic.c -o dspic
 pic30-elf-bin2hex dspic


4) Download and compile Homer Reid's programming software:
http://homerreid.ath.cx/misc/dspicprg/

5) Build JDM-style programmer. You should ensure 5V for dsPIC and proper
level shifting for these signals:
   TD --> MCLR (RS232 to 0V/9V, should rise quickly to at least 9V )
   RTS --> PGC (RS232 to logical levels)
   DTR --> PGD (RS232 to logical levels)
   CTS <-- PGD (logical levels to RS232, working at least when DTR is high)
 All this signal conditioning keeps polarity, no inversion.

6) Take special care to filter PGC and PGD as dsPIC is really really picky
regarding these signals. For me, it seemed to work with just 82pF between
PGC and GND, but might better follow the original advice:

...put 22..47 pF on the PGD and PGC lines to ground near the target chip. In
addition, put a 100 ohm resistor in series with the PGD line between target
chip and the cap


7) Try to guess whether things work buy observing the hex file produced by
something like:

dspicdmp -p 760

where "760" is the base port IN DECIMAL (look at /proc/ioports for ideas)
and when confident enough, flash your program with something like

dspicprg -p 760 -c pic30f4012 -f dspic.hex


8) Connect MCLR to +5V and enjoy blinking LED.



So far the C code cannot use global variables, look here to know more:
http://forum.microchip.com/tm.asp?m=85994

And please consider pushing the status of free tools a little bit forward.
Well, I am happy to have my blinking LED, but I might have one without going
through 1000+ pages of manuals  If you want any further progress on the
Linux front, it might very well be up to you now

Many thanks to Microchip, John, Homer and Olin.

Regards

Vaclav Hanzl


http://forum.microchip.com/



2005\05\19@002120 by Mark Rages

face picon face
On 5/18/05, Chen Xiao Fan <xiaofanspamKILLspamsg.pepperl-fuchs.com> wrote:
> Now I wish someone can make ICD2 work under Linux
> (even only as a programmer).
>
> Xiaofan
>

Xiaofan,

Have you tried this project?
http://www.landamore.com/pic.html

Regards,
Mark
markrages@gmail
--
You think that it is a secret, but it never has been one.
 - fortune cookie

2005\05\19@014931 by Chen Xiao Fan

face
flavicon
face
Great. I will check it out as soon as possible.

Xiaofan


-----Original Message-----
From: Mark Rages [.....markragesKILLspamspam.....gmail.com]
Sent: Thursday, May 19, 2005 12:21 PM
To: Microcontroller discussion list - Public.
Subject: Re: [PIC] Success report: C, bare dsPIC and Linux free tools
(forward )


Xiaofan,

Have you tried this project?
http://www.landamore.com/pic.html

Regards,
Mark
markrages@gmail

2005\05\19@200057 by Chen Xiao Fan

face
flavicon
face
Thanks for pointing out this link.

It looks promising and I have it compiled successfully
both under Linux and Cygwin (Windows).

-----Original Message-----
From: Mark Rages [EraseMEmarkragesspam_OUTspamTakeThisOuTgmail.com]
Sent: Thursday, May 19, 2005 12:21 PM
To: Microcontroller discussion list - Public.
Subject: Re: [PIC] Success report: C, bare dsPIC and Linux free tools
(forward )

Have you tried this project?
http://www.landamore.com/pic.html

Regards,
Mark
markrages@gmail

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