EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

PIC32 starter kit impressions

Started by Joseph H Allen November 12, 2007
I got PIC32 starter kit today.  Here are some impressions:

- Comes with eval version of C32 C-compiler with 64KB code size limit.  C32
  is actually called C32-gcc, so it's a gcc derivative.  The source is on
  the website, but who knows if it's recent or complete.

- Hardware debugging (breakpoints, goto cursor) works in MPLAB on this
  little board, but I found that sometimes it gets into a mode where it
  thinks that breakpoints are not supported: "breakpoint limit for hardware
  is 0" in the breakpoint dialogue.  This is fixed if you restart MPLAB. 
  Anyway, you can view both assembly and C source during single-stepping. 
  It's pretty nice.

- You can DBPRINTF over JTAG (and also DBGETS).  It's very slow.  It was not
  documented that you had to add a define to make this work for new projects
  (-DPIC32_START_KIT- add the define in Project->Build
  Options->Project->C-compiler->Macros).  The debug I/O library is not part
  of the main library- it was just a db_utils.a file (no source) in the
  StartKitTutorial directory (the "hello world" program).

  I had to copy it to the timer interrupt demo program that I wanted to try
  to get it working.  I then had to replace all the UART I/O calls to debug
  I/O calls.  There is no UART interface on the starter board, so they must
  be designing these demos for some other board (actually they are labs for
  a course- maybe FAE or early customer training?)

  One annoying thing about this form of JTAG I/O (which is not unique to
  PIC)- it's not a real serial port.  When you call DBGETS, a window pops up
  in MPLAB for you to type a string.  This is a modal window, so you can not
  actually halt the debugger when it is up.  So don't put DBGETS in a loop! 
  There is no way to poll for keyboard input.  When the DBGETS is waiting
  for input, the CPU is basically break-point halted, so interrupts stop
  running.

- This is how you make interrupt handlers:

      void __ISR(TIMER_1_VECTOR, ipl2) my_handler(void)
      {
      mPORTDToggleBits(BIT_0); // Blink a led
      mT1ClearIntFlag();
      }

  And that's about it (set up the timer and EnableIntT1).  You do not have to
  explicity write the my_handler address to a vector, the compiler just does
  it.

- The IDE needs a little work.  There were some screen update glitches when
  I closed various windows.  It core dumped when switching projects.  The
  manual for the C-libraries (particularly the peripherals) is missing.

- On the other hand, things did generally work.  You basically hit F10 to
  compile and F9 to run.  It prompts you for downloading the code to the
  board.

- There are compiler settings for making compressed MIPS 16-bit code (like
  the ARM thumb code).  Both worked.  Last time I used MIPS, there was no
  16-bit option.

Some notes about the PIC32 CPU:

- Someone complained that the chip has only 16-bit timers: this is not
  exactly true: timers can be paired up to form single 32-bit timers.

- There is a RTC clock generator (and an RTCC block) on the chip with pins
  for a 32 KHz crystal.

- There is support for some kind of external trace buffer on the CPU.  You
  must have to buy some special ICE to make use of it.

- The code examples include HTML server on a TCP/IP stack, but they need a
  board with Microchip's ethernet to SPI interface chip.

-- 
/*  jhallen@world.std.com AB1GO */                        /* Joseph H. Allen */
int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)
+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2
]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);}
can you comment on the power consumption of these devices? All I saw on the
family datasheet was TBD for all current ratings.


Hi, sorry about the multiple sends - unfamiliarity with this setup is my
excuse!
Nice post. I've ordered a PIC32 starter kit and look forward to having a
play with it in the next week or two. I'll feed back any points additional
to those already posted if and when I find them. I'm new to MIPS32 code so
it should be fun.
Regards,
Joe Brown.

>I got PIC32 starter kit today. Here are some impressions: > >- Comes with eval version of C32 C-compiler with 64KB code size limit.
C32
> is actually called C32-gcc, so it's a gcc derivative. The source is
on
> the website, but who knows if it's recent or complete. > >- Hardware debugging (breakpoints, goto cursor) works in MPLAB on this > little board, but I found that sometimes it gets into a mode where it > thinks that breakpoints are not supported: "breakpoint limit for
hardware
> is 0" in the breakpoint dialogue. This is fixed if you restart MPLAB.
> Anyway, you can view both assembly and C source during single-stepping.
> It's pretty nice. > >- You can DBPRINTF over JTAG (and also DBGETS). It's very slow. It was
not
> documented that you had to add a define to make this work for new
projects
> (-DPIC32_START_KIT- add the define in Project->Build > Options->Project->C-compiler->Macros). The debug I/O library is not
part
> of the main library- it was just a db_utils.a file (no source) in the > StartKitTutorial directory (the "hello world" program). > > I had to copy it to the timer interrupt demo program that I wanted to
try
> to get it working. I then had to replace all the UART I/O calls to
debug
> I/O calls. There is no UART interface on the starter board, so they
must
> be designing these demos for some other board (actually they are labs
for
> a course- maybe FAE or early customer training?) > > One annoying thing about this form of JTAG I/O (which is not unique to > PIC)- it's not a real serial port. When you call DBGETS, a window pops
up
> in MPLAB for you to type a string. This is a modal window, so you can
not
> actually halt the debugger when it is up. So don't put DBGETS in a
loop!
> There is no way to poll for keyboard input. When the DBGETS is
waiting
> for input, the CPU is basically break-point halted, so interrupts stop > running. > >- This is how you make interrupt handlers: > > void __ISR(TIMER_1_VECTOR, ipl2) my_handler(void) > { > mPORTDToggleBits(BIT_0); // Blink a led > mT1ClearIntFlag(); > } > > And that's about it (set up the timer and EnableIntT1). You do not
have to
> explicity write the my_handler address to a vector, the compiler just
does
> it. > >- The IDE needs a little work. There were some screen update glitches
when
> I closed various windows. It core dumped when switching projects.
The
> manual for the C-libraries (particularly the peripherals) is missing. > >- On the other hand, things did generally work. You basically hit F10
to
> compile and F9 to run. It prompts you for downloading the code to the > board. > >- There are compiler settings for making compressed MIPS 16-bit code
(like
> the ARM thumb code). Both worked. Last time I used MIPS, there was
no
> 16-bit option. > >Some notes about the PIC32 CPU: > >- Someone complained that the chip has only 16-bit timers: this is not > exactly true: timers can be paired up to form single 32-bit timers. > >- There is a RTC clock generator (and an RTCC block) on the chip with
pins
> for a 32 KHz crystal. > >- There is support for some kind of external trace buffer on the CPU.
You
> must have to buy some special ICE to make use of it. > >- The code examples include HTML server on a TCP/IP stack, but they need
a
> board with Microchip's ethernet to SPI interface chip. > >-- >/* jhallen@world.std.com AB1GO */ /* Joseph H.
Allen */
>int
a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)
>+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2 >]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n","
#"[!a[q-1]]);}
>

The 2024 Embedded Online Conference