BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 8:13 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Mad Hatter
PostPosted: Sat May 07, 2011 8:36 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
I see the Mad Hatter Micro controller Board was released :). For those who have not looked up on the main Basic Micro website, the Mad Hatter board is an Atom Pro based board with an Arduino form factor and pin outs. Nathan and Dale have been working on making this board compatible with many of the Arduino Shields. From the description I am still assuming an H8/3687 processor running at 20mhz.

What I was wondering is if there is a spec sheet for the board? From an earlier post in the Wish List forum, you posted a possible pin out for this board, which I included below. Is this pinout still accurate?

Kurt

Code:
Arduino Pins        Atompro Pins
reset                  reset   
3v3                    3v3
5v                      5v
GND                   GND
GND                   GND
Vin                     Vin

0                        PB0/AN0      P30              P55/WKP5      p87 to pin through 10k resistor
1                        PB1/AN1      P31              P54/WKP4      p86 to pin through 10k resistor
2                        PB2/AN2      P32              p85 to pin through 10k resistor
3                        PB3/AN3      P33              p37 to pin through 10k resistor
4                        PB4/AN4      P56/SDA      P34                p36 to pin through 10k resistor
5                        PB5/AN5      P57/SCL      P35                p24 to pin through 10k resistor

AREF                   NC
GND                   GND
13                      PB5(SCK)              P70/SCK3_2            P53/WKP3      p23 to pin through 10k resistor
12                      PB4(MISO)            P71/RXD_2              P12            P52/WKP2
11                      PB3(MOSI/OC2A)  P61/FTIOD0             P72/TXD_2      P11/PWM       
10                      PB2(SS/OC1B)      P63/FTIOC1             P10/TMOW                 
9                        PB1(OC1A)            P64/FTIOC0                                 
8                        PB0(CLKO/ICP1)    P62/FTIOA1             P76/TMOV         
7                        PD7(AIN1)             PB6/AN6                  P51/WKP1
6                        PD6(OC0A/AIN0)   P66/FTIOB0             PB7/AN7         P74/TMRIV     
5                        PD5(OC0B/T1)      P65/FTIOB1             P60/FTIOA0                     
4                        PD4(XCK/T0)         P20/SCK3                P75/TMCIV      P50/WKP0
3                        PD3(OC2B/INT1)   P67/FTIOD1             P15/IRQ1/TMIB1   
2                        PD2(INT0)             P14/IRQ0
1                        PD1(TXD)              P22/TXD                  P17/IRQ3/TRGV
0                        PD0(RXD)              P21/RXD                  P16/IRQ2


Top
 Profile  
 
 Post subject: Re: Mad Hatter:
PostPosted: Sat May 07, 2011 10:47 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
That's the list I'm working with.

Arduino to the 3687 AtomPro. use latest rev 11 !

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter:
PostPosted: Mon May 09, 2011 10:21 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Arduino Digital pins 0 to 13 are AtomPro pins P0 to P13.
Arduino Analog pins 0 to 5 are AtomPro pins P14 to P19.

There is equivilent functionality(eg PWM capabilit, interrupt capability, analog capability etc) to every Arduino hardware device on every Mad Hatter Pin with one exception. Pins P16 to P19 do not have any interrupt support. On an arduino these pins have onchange interrupt capability. I researched several hundred shields and found none that used this functionality.

THe pinout is close but I think there were some changes since then:

Arduino Pins            Atompro Pins
reset reset
3v3 3v3
5v 5v
GND GND
GND GND
Vin Vin

0 PB0/AN0 P30 P55/WKP5 p87 to pin through 10k resistor
1 PB1/AN1 P31 P54/WKP4 p86 to pin through 10k resistor
2 PB2/AN2 P32 p85 to pin through 10k resistor
3 PB3/AN3 P33 p37 to pin through 10k resistor
4 PB4/AN4 P56/SDA P34 p36 to pin through 10k resistor
5 PB5/AN5 P57/SCL P35 p24 to pin through 10k resistor

AREF NC
GND GND
13 PB5(SCK) P70/SCK3_2 P53/WKP3 p23 to pin through 10k resistor
12 PB4(MISO) P71/RXD_2 P12 P52/WKP2
11 PB3(MOSI/OC2A) P63/FTIOD0 P72/TXD_2 P11/PWM
10 PB2(SS/OC1B) P66/FTIOC1 P10/TMOW
9 PB1(OC1A) P62/FTIOC0
8 PB0(CLKO/ICP1) P64/FTIOA1 P76/TMOV
7 PD7(AIN1) PB6/AN6 P51/WKP1
6 PD6(OC0A/AIN0) P61/FTIOB0 PB7/AN7 P74/TMRIV
5 PD5(OC0B/T1) P65/FTIOB1 P60/FTIOA0
4 PD4(XCK/T0) P20/SCK3 P75/TMCIV P50/WKP0
3 PD3(OC2B/INT1) P67/FTIOD1 P15/IRQ1/TMIB1
2 PD2(INT0) P14/IRQ0
1 PD1(TXD) P22/TXD P17/IRQ3/TRGV
0 PD0(RXD) P21/RXD P16/IRQ2


And, yes, it is using a 3687 at 20mhz.

I'll be adding some of the first example code, USB shield keyboard and mouse as well as SD shield and FAT examples, to the library in Studio and making a new release soon. The chip name will be updated to Mad Hatter as well. In Studio 2.0.0.11 it is still showing the development name we used, AtomProDuino.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Mad Hatter:
PostPosted: Mon May 09, 2011 11:03 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Nathan, Dale,

The Mad Hatter uses AtomPro pins P14 to P19 to represent Arduino Analog pins 0 to 5. Any thought to calling them A0-A5 in studio? Not really necessary, I guess. Just need comments to define (constants) A0-5 as A14-19 in the manual.

It's working! I have 4 short programs written for the Mad Hatter to demo some basic electronics (LED, switch, servo). Tutorial is roughed out as well, and I shot about 50 pix from which to select accompanying photos. Need a place to post the tutorial!

Any thoughts to stocking some Arduino shields? A couple of prototype boards would be useful, as the Arduino board pin-out is not as nicely laid out with 3-pin headers for servos, sensors, etc. But using the Arduino form factor DOES open up a whole batch of boards (shields) to plug into the Mad Hatter!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter:
PostPosted: Mon May 09, 2011 11:42 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
Hi Nathan,

Thanks for the update.

I am making a few assumptions here. That is for several of the pins you say, things like:
p87 to pin through 10k resistor

My assumption is that you are using this pin as a pull-up resistor for the pin to handle the cases where for example you may do something like:
digitalWrite(13, HIGH);
pinMode(13, INPUT);

Where on the Arduino this will enable the built-in 20k pull-up resistor for the pin.

Kurt


Top
 Profile  
 
 Post subject: Re: Mad Hatter:
PostPosted: Tue May 10, 2011 9:50 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Yes, the pins through a pullup resistor are there to added pullup/down support to pins that don't already have internal pullup capability to match that capability on the Arduino.

Alan, you can define your own pin numbers A0 to A5 if you want:

A0 con P14
A1 con P15
A2 con P16
A3 con P17
A4 con P18
A5 con P19

We are working on some of our own shields and will probably be carrying some other companies shields, just don't know what the timeline is right now.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Mad Hatter:
PostPosted: Tue May 10, 2011 10:20 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Yes, I've defined them!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Tue May 17, 2011 7:15 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
I received my Mad Hatter :) Should be fun to play with.

One thing I miss so far on the board is the LED on Digital pin 13 which I think is more or less standard on most Arduino boards. So my simple Hello program:
Code:
main:
   toggle P13
   pause 250
   goto main


Does not blink an LED like the equivlent sketch would do on the Arduino.

I thought one of the first shields I would try out is to use the XBee shield that I purchased awhile ago and have not tried. The one I have is from NKC Electronics. However I think it is more or less based on the standard XBee shield you can find from the reference pages for Arduino:
http://arduino.cc/en/Main/ArduinoXbeeShield. This shield is listed is listed on the product page.

It looks like these boards are not compatible, at least not without a few hardware hacks. The problem is these boards do not use the power pins to get power, but instead get the power and ground from the ICSP connector which the mad hatter board does not have. It also uses has a reset button on the board that also connects to the ICSP connector. Could probably use some jumper wires from your board to the shield. However even with this I am not sure I wish to use this shield as it connects the XBEE on digital pins 0 and 1, which are the same two pins as the USB. They also have jumpers such that you can connect the XBee directly to the FTDI chip of the Arduino, and use the Arduino board/Shield directly with the PC, but this only works if you remove the processor chip. Some reason I think this may not be valid with the Mad Hatter :lol: So I think I am better off with separate XBee holder like the sparkfun or Parallax unit.

The next board to look at and probably not use is a renbotics Servo shield. http://www.renbotics.com/products/servoshield.php
It has connections for 16 servos, plus it's own power connector/bus which is nice. The one I have, I modified the board itself to actually have 18 servo connections, I was going to try it with a 3dof hex awhile ago, but never did. The board uses 2 4017 decade counters to control the servos. It uses IO pins 6-9. You can not turn off a specific servo, but can turn on or off a complete block of them. On Arduino/mega it uses either 1 or 2 timers to control all of the servos. Not sure it is worth it here as we already have HSERVO. But maybe?

The only other Arduino (non mega) shield I have is a prototype board I did when I was playing around with an Arduino Brat. I had 8 servo connections, the connected through to VIN and 6 more 3 pin connections hooked up with +5v, which connected to the Analog pins, and I had 4 more digital pins hooked up for a PS2... So I might try out this board. Should be fun. Maybe Hookup the brat with it...

Questions/Suggestions:
1) Nathan, you mentioned that you used H8 IO pins as pull-up resistors. How are we supposed to make use of this with these boards? For example if I am using digital pins 10-13 to connect up the PS2 and wish for 13 to have a pull-up enabled, do I have to look at the underlying table, and try to poke the right values into the H8 registers. You use P23 here so need to work with PDR2 and PCR2... Or are you providing some command that handles it for the user.

2) with the prototype card I mentioned above, I found that if I was not careful on my Brat, it would try to run the servos over the USB connection, which would use to much current and cause the USB to shutdown... Couple of questions here: did you put a resettable fuse into your USB circuit to keep the USB from drawing too much current from the USB? The board has a 3 pin header with a shunt named PWR_SEL, My guess is if I move the shunt down to pins 1,2 it will no longer power over the USB, is this correct?

3) I wish the board had pin labels and the like. The ones from Seeeduino have labels on both side, where as the official Arduino appears to have it on top, they also include other labels that give clues which pins can do what.

4) Information on the other jumpers.

5) Wish you had part of the ICSP connector in place. At least for +5v and GND and maybe reset. I have used those pins as another place to get power and ground...

That is all for now.

Kurt

P.S. - Please let me know if you would prefer comments and the like in email instead of posts.


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Tue May 17, 2011 9:12 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Have fun with your new board!

You might need to set the pin to output, if you haven't already.

pinMode(LED_HEART, OUTPUT);

I generally hang an LED on pin 13 on the prototype board anyway.

The RX TX lines into the FTDI chip of the Arduino UNO have 1K resistors, I wondered about that too, if it is then possible to run a Blue Smirf on the same lines.

I could use the servo shield! I do use a little shield available from Mouser. $6

and a "servo header" PCB I made that gives me two banks of 3-pin servo/sensor connectors on my ASB-13 'bot.

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Wed May 18, 2011 2:19 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Kirt,

did you look at the schematic and code for the ServoShield? I get it that the chip is a Johnson ring counter, that the CLK line shifts the "ON" output to the next stage, and that the RES line clears. I don't see any CP connections, and the two counters aren't cascaded.

Once on the proper bit, I understand how the bit could be reset by a timer counting pulse width. And the bit selected could be advanced through another timer (or off time). But it looks like you'd always be going back to bit 0 if you pulsed the RES line. no?

Maybe they rapidly count through the bit positions until they get to the bit they want, time it out, then reset?

Just curious. Interesting way to get multiple servo pulse widths out of only two lines and a 4017 (x2).

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Wed May 18, 2011 2:51 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
Hi Alan,

Yes I looked at their schematic and through their code for the Servoshield. Earlier while I was waiting for my boards to arrive, I went through their code and fixed a few issues. My version also allowed for 18 servos and I allowed you to define a max servos, that if less than 9 would only use 1 timer...

It has been awhile since I looked at the datasheet/code, but if I remember correctly each time you pulse one pin, it changes which pin goes high. So if P0 was high and when you toggle the correct pin, it will bring P0 low and raise P1... So the trick of the code is that you have to time when you do this pulsing to be the pulse width for a pin. You leave one pin not connected, which you use to pulse with the appropriate time to make the complete cycle for the 9 pins to be 20ms. They don't cascade them as to run through more servos could easily take longer than 20ms. So they use a second clock to handle that. I believe the 2nd IO pin to this counter is an enable. So you can turn the whole thing off... So a problem with this type of setup is that you can not turn on or off specific servos...

Kurt


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Wed May 18, 2011 4:21 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Still an interesting way to implement. Not quite as flexible as I'd like.

Actually, for 4 pins, SPI works well. Probably more overhead.

Thanks!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Thu May 19, 2011 9:57 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Kurt,

1. For now, yes you need to access the pins directly. I'll be adding a special command just for the madhatter that will make this easy, just have to get the time.

2. Yes, if you switch the pwr jumper you will power from the 2.1mm power connector instead of from the USB. There is no fuse but the current draw is limited to what the USB port will let you have.

3. and 5. I'll pass both these suggestions on. When I went through every arduino shield I could find I didn't find any that used the ICSP pins directly, then after we had our first production I found 1, a new version of the USB shield uses them, and now this one. Not much we can do about adding the ICSP signal lines but we can do something about the power/gnd pins.

4. The two paired jumpers switch UART1 from the FTDI to pins p0 and p1. The single jumper on the 3 jumper block connects RTS to the reset circuit. One of the unjumpered ones connect DTR to the reset circuit and the other is for connectiong a wired reset button to the board. The datasheet, when it's done, will have all this documented.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Thu May 19, 2011 10:50 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
I like having the jumpers for the tx/rx! Should make connecting a Blue Smirf easier! (I wish the Arduino UNO did).

Can the Mad Hatter support a timer interrupt per this Arduino function?

Code:
#include <MsTimer2.h>
...

  MsTimer2::set(1, ItsAlive); // 1ms period
  MsTimer2::start();
...

void ItsAlive(void)
  {
   ++SystemTick2;   /* 1mS timer for delays */
...

  if(--Tickcount == 0)
    {
    Tick = TRUE;    /* Tick rate 100mS */
    Tickcount = 100;
    }
  }



Alan KM6VV

Acidtech wrote:
<snip>
4. The two paired jumpers switch UART1 from the FTDI to pins p0 and p1. The single jumper on the 3 jumper block connects RTS to the reset circuit. One of the unjumpered ones connect DTR to the reset circuit and the other is for connectiong a wired reset button to the board. The datasheet, when it's done, will have all this documented.

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Mad Hatter
PostPosted: Thu May 19, 2011 12:04 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
Hi Alan,

You can setup a timer like other BAPS... For example I have used the following in things like the Bap40.

Code:
lTimerCnt         var long   

;--------------------------------------------------------------------
;[TIMER INTERRUPT INIT]
TIMERINT   con   TIMERB1INT
ONASMINTERRUPT TIMERB1INT, HANDLE_TIMERB1_ASM

InitTimer:
  WTIMERTICSPERMSMUL con 256 ; H8/3687 is 20mhz need a multiplier and divider to make the conversion with /8192
  WTIMERTICSPERMSDIV con 625  ;
  TMB1 = 0   ; clock / 8192               ; Low resolution clock - used for timeouts...
  ENABLE TIMERB1INT
  ENABLE
  return
   BEGINASMSUB
HANDLE_TIMERB1_ASM
   push.l    er1                  ; first save away ER1 as we will mess with it.
   bclr    #5,@IRR2:8               ; clear the corresponding bit in the interrupt pending mask
   mov.l    @LTIMERCNT:16,er1      ; Add 256 to our counter
   add.l   #256,er1
   mov.l    er1, @LTIMERCNT:16
   pop.l    er1
   rte
   ENDASMSUB
;==============================================================================
;[GetCurrentTime] - Gets the Timer value from our overflow counter as well as the TCA counter.  It
;                makes sure of consistency. That is it is very possible that
;                after we grabbed the timers value it overflows, before we grab the other part
;                so we check to make sure it is correct and if necessary regrab things.
;==============================================================================
GetCurrentTime:
  lCurrentTime = lTimerCnt + TCB1
  ; handle wrap
  if lTimerCnt <> (lCurrentTime & 0xffffff00) then
   lCurrentTime = lTimerCnt + TCB1
  endif

  return lCurrentTime


;-------------------------------------------------------------------------------------
;[ConvertTimeMS]
_ttconv   var   long
ConvertTimeMS[_ttconv]:
   return (_ttconv * WTIMERTICSPERMSMUL)/WTIMERTICSPERMSDIV



As you can see I have this code in pieces to allow you to call. In my program this code is #ifdef by processor so for Bap28 I user TimerA instead... Also I did a quick cut and paste so I may have missed something.

Kurt


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO