Micromouse book
Categories
Recent Comments
Meta
Popular Posts
- Simple ADC use on the STM32 (4,106)
- STM32 Arm-Cortex bootloader (2,804)
- STM32 USART basics (2,704)
- All Japan Micromouse 2011 – finals (2,011)
- STM32F4 – the first taste of speed (1,690)
- Micromouse Book (1,589)
- Nokia 3410 LCD on the STM32 (1,337)
- CodeSourcery GNU Toolchain for the ARM on a Mac (1,145)
- Bit Banding in the STM32 (1,048)
- ARM STM32 JTAG (973)
Blogroll
-
Upcoming Events
Tag Archives: dsPIC30F4011
A bit of a change to Primus
It seems I made a bit of a mistake in how I thought the dsPIC could drive its PWM module. Consequently, there will have to be some changes.First, what can’t change is the need to use T1CK and T2CK as external inputs to count motor pulses. There are no other choices on the dsPIC30F4011 without using interrupts. Since I anticipate pulse rates of up to 100,000 Hz per wheel, life will be a lot easier not having to service that interrupt rate, even with a fast processor and a very efficient ISR.
Somehow, I had it in my head that the PWM module could use different time bases for each channel. Wrong – and stupid. So, how to produce two independant pulse trains at frequencies from about 500Hz to 125kHz?Well, the dsPIC has a set of Output compare modules. These are quite capable of the job and have a variety of useful modes. Each can use one of two 16 bit timers for its timebase. At first sight, it would be best to use the OC modules for both motors and have each derived from a separate timer. Unfortunately, the two timers we can pick form are Timer2 and Timer3. But we have already committed Timer2 to the pulse counting job. That means that only one OC module can be used and it must be driven from a timebase using Timer 3.This all makes things a bit tacky. The pin assignments are now a little more confusing and earlier posts will need to be edited along with theschematics and such. Hopefully this will be done by the time anyone gets to read this post. Apologies if anyone has done any work based on the errors. Continue reading
Primus pin functions
The Primus micromouse will use the dsPIC30F4011 processor from microchip. It has plenty of power and resources for just about any micromouse and is relatively easy to get and use. Here is a list of the proposed functions for each processor pin on the controller board
| dsPIC30F4011 Pin Functions for Primus | ||
| Pin | Functions | Primus (NOKIA LCD) |
| 1 | /MCLR | reset |
| 2 | EMUD3/AN0/VREF+/CN2/RB0 | left forwardsensor |
| 3 | EMUC3/AN1/VREF-/CN3/RB1 | left diagonal sensor |
| 4 | AN2/SS1/CN4/RB2 | left side sensor |
| 5 | AN3/INDX/CN5/RB3 | right side sensor |
| 6 | AN4/QEA/IC7/CN6/RB4 | UP button |
| 7 | AN5/QEB/IC8/CN7/RB5 | DN button |
| 8 | AN6/OCFA/RB6 | right diagonal sensor |
| 9 | AN7/RB7 | right forward sensor |
| 10 | AN8/RB8 | battery voltage monitor |
| 11 | VDD | VDD |
| 12 | VSS | VSS |
| 13 | OSC1/CLKI | 8MHz resonator |
| 14 | OSC2/CLKO/RC15 | 8MHz resonator |
| 15 | EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 | left stepper count input |
| 16 | EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 | right stepper count input |
| 17 | FLTA/INT0/RE8 | GO button |
| 18 | EMUD2/OC2/IC2/INT2/RD1 | diagonal emitters |
| 19 | OC4/RD3 | LED_A |
| 20 | VSS | VSS |
| 21 | VDD | VDD |
| 22 | OC3/RD2 | side emitters |
| 23 | EMUC2/OC1/IC1/INT1/RD0 | forward emitters |
| 24 | SCK1/RF6 | LCD clock |
| 25 | PGD/EMUD/U1TX/SDO1/SCL/RF3 | programmer and LCD Data |
| 26 | PGC/EMUC/U1RX/SDI1/SDA/RF2 | programmer clock |
| 27 | U2TX/CN18/RF5 | Serial TX |
| 28 | U2RX/CN17/RF4 | Serial RX |
| 29 | C1TX/RF1 | LCD command/data |
| 30 | C1RX/RF0 | LCD select |
| 31 | VSS | VSS |
| 32 | VDD | VDD |
| 33 | PWM3H/RE5 | Motor Enable |
| 34 | PWM3L/RE4 | LED_B and speaker |
| 35 | PWM2H/RE3 | right motor direction |
| 36 | PWM2L/RE2 | right motor step |
| 37 | PWM1H/RE1 | left motor direction |
| 38 | PWM1L/RE0 | left motor step |
| 39 | AVSS | AVSS |
| 40 | AVDD | AVDD |
Primus will use the Nokia LCD display from a 3410 cellphone. Note that this is not the common screen from a 3310. the 3310 screen can only do 84×48 pixels. To display the maze we need a bigger screen and the 3410 display can do 96×64 pixels. They are easy to find on the web.
You will see there are six sensor inputs but three emitter outputs. The emitters are fired in pairs to save processor pins. There is provision for three user buttons, a serial interface, the LCD and a battery monitor as well as a speaker and a couple of LED indicators.If you wanted to build Primus without the LCD then two of the buttons are probably redundant also as they are used for the menus on the mouse. The LCD is well worth the trouble and, while you may have thought of using a common 16×2 alphanumeric display, the nokia screens are cheaper, smaller, lighter and much more flexible. Continue reading
Add to Google