Home › ELEKTOR FORUMS › DigiButler (April & May 2008) › Digibutler Kirin3

ELEKTOR FORUMS

Please log in to post a reply or subscribe / unsubscribe to topics

Topic: Digibutler Kirin3

Author Post

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 12-10-2009 23:38

Digibutler new adventure

Digibutler allows us to become familiar with the ColdFire V2 microcontrollers.

Today, Freescale offers the following: family Kirin3.

The MCF52259 seduced me:
- 80MHz (+33%)
- RAM 64k
- Flash 512k
- Mini FlexBus (extensions possible)
- USB OTG

So I decided to embark on a new adventure: DigibutlerK3, the successor to Digibutler.

My specifications:
- Power supply 8-15Vdc
- Keep Digibutler functions:
- Ethernet on RJ45
- Uart0 on DE9
- GPT0-3
- I2C
- Ana0-7
- Relay output
- BDM (TBLCF)
- Support SD card
- 512K RAM
- Expansion Bus
- QSPI
- USB Host (USB key)

In my inspiration from the eval boards M52259DEMO and M52259EVB (Freescale website)
I made this electronic schematic: "DigibutlerK3_sch.pdf".

---(1)--- POWER supply 8-15Vdc:
2 regulators (TO220) produce 5V and 3V3
- A 7805 for the +5 V USB and Relay
- LF33 for 3V3

---(2)--- MCU:
(Freescale) MCF52259CAG80 144 LQFP because I have no oven

---(3)--- PHYSICAL LAYER Ethernet:
We may regret the absence of physical layer, but it doesn't work properly on the Kirin2.
Then
(Micrel) KSZ8041TL TQFP
I choose this package because it is easier to solder

---(4)--- RJ45 with integrated transfo:
2 types available
- (Pulse) J0-0065NL with integrated LED
- (Wuerth Elek) MID-COM MIC24010-107T-LF3

---(5)--- RTC:
We may choose to supply the RTC with the 3V3 General (J15) or J14 on external battery

---(6)--- RAM:
(ISSI) IS61LV5128AL-10TLI 512K 8bits
After reading the AN3854 (using the Mini-FlexBus External Bus Interface for ColdFire ® Microcontrollers)
I preferred a 8bits SRAM rather than the MRAM (because no Wait State with SRAM).
The solution 16bits (much faster) does not allow 8bits access.

---(7)--- SD:
(MULTICOMP) SDCMF-10915W0T0
connected to DTIN0-3 for control by SPI software.
The SPI hardware (QSPI) is retained for high-speed SPI.

---(8)--- USB:
We can use the USB connection to Host or Device.
For this, there are 2 connectors.
The first one, Type A can connect key, keyboard, mouse (HID + Mass Storage)
The second, Mini USB allows a OTG connection. J12 supply or not the Pin 1 of MiniUSB.

---(9)--- SERIAL:
Uart0 is connected to a DE9 via a MAX3232 (Rx, Tx, RTS, CTS).
Uart1 is connected to J13 (Rx, Tx)

---(10)--- SPI:
The J13 connector receives QSPI (SPI_MISO, MOSI, SCK and CS0)
We can connect the expansion board "IO_EXP_01A" with expanders MicroChip.

---(11)--- GPTx and I2C:
J6 has the same signals as J6 of Digibutler.
GPT0-3 SDA0 and SCL0

---(12)--- ANAx:
D7 has the same signals as J7 of Digibutler.
Ana0-7

---(13)--- Relay:
Same mounting of the relay that Digibutler, but with the addition of a 1µF capacitor on the transistor base.
Can manage an SPI software like Digibutler without switching on/off the relay.

---(14)--- BDM:
Necessary for programming the microcontroller.
I have not connected ALLPST but PST0-3 on pins 12-15.

---(15)--- BUS expansion:
J8 receives D0-7, A0-19, RW, OE, CS1 which should enable the realization of extension.


All components are Farnell catalog or Digi-Key.

The components location is done on a 120x95mm board "DigibutlerK3_cnx.jpg.

The PCB is 4 layers "DigibutlerK3_pcb.jpg".
layer1 red: components layer
layer2 internal GND
layer3 internal PWR 3V3
layer4 blue: solder layer

On the solder side, there are only 100nF capacitors.

I wait about 2 or 3 weeks before making the board by Elektor PCB Service.
THIS WILL MAKE THE CORRECTIONS IF YOU FIND ERRORS.


Files:
"DigibutlerK3_cnx.jpg" components location
"DigibutlerK3_sch.pdf" electronic schematic
"DigibutlerK3_pcb.jpg" PCB (2 layers/4)

Greetings, Henri

AttachmentDigibutlerK3_sch.pdf

Sylvain

7 posts

Popping In
Popping In

Read post 13-10-2009 13:16

Hello Henri!

Your plan sounds good!
32k is definitely too small in digibutler.

What IDE will you use? Codewarrior? Remember it is limited to 128ko of program!

Another IDE and RTOS is available for this µC, IAR_YELLOWSUITE.

Let me add a suggestion:
perhaps you could connect the "card_detect" pin of sd_card connector, It may be practical if one wants to be able to mount/unmount sd_cards.

I think you have connected all pins of the coldfire, that's a good point two!

I still use your work on sd_card and FAT porting.

Thanks for all.

Sylvain

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 14-10-2009 00:40

Thank you sylvain,

You're right, a connection "card_detect" is useful and easy to add (uart2_rts free and on the good side of the micro).
At the same time, I'll add a CAN bus connection (TJA1050 on UART2) for using the FlexCAN.

I'll correct the schematic and PCB in 1 day or 2.

For the compiler, I use:
- Up to 128kb : CodeWarrior with TBLCF
- Beyond 128kb:
Compiler: GCC (CodeSourcery G++ Lite 4.2.1)
IDE: Eclipse
Flash Tool: CFFlasher with P&E USB-ML-ColdFire

Today, CFFlasher does not work with TBLCF.
So when I'm more advanced in the project, if CFFlasher doesn't still manage TBLCF, I will look at an app similar that works with TBLCF and Kirin2/3.
I do not think it's too hard to do.

Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 16-10-2009 00:07

Hello,

It's done, I added a "card_detect".

Adding a connection FlexCAN will allow the use of IOs CanOpen.

Since I changed the layout, I added a connector 4 points to plug a camera "C328R"
- uart1_tx
- uart1_rx
- gnd
- +3V3 enabled by "uart1_cts" (when the camera hangs up)

The PCB is also updated.

If you have any other ideas? ...

File:
"DigibutlerK3.zip" schematic + pcb

Greetings, Henri

AttachmentDigibutlerK3.zip

Sylvain

7 posts

Popping In
Popping In

Read post 20-10-2009 09:25

Hello Henri!

I think you will need a pull-up to make the sd_detec work correctly. The connector ties sd_detec to ground when you insert a card.

Please see the attached pdf.

Write protect works in the same manner.

Greetings,

Sylvain

AttachmentSDCARD-CON.pdf

Sylvain

7 posts

Popping In
Popping In

Read post 20-10-2009 09:42

Another question about this project but also about your developments for digibutler: according to you, is it possible to use QSPI to talk to the sd_card. Did you succeed in using that before software SPI?

It may be more efficient, and we may be able to use DMA channels in this case.

What do you think about that?

Sylvain

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 20-10-2009 20:18

Hello Sylvain,

---(1)--- pull-up
I did not put pull-up on "card_detect" because "uart2_rts" already has one (internal) when used as GPIO (MCF52259DS.pdf).
The internal pull-up should be enough for a contact.
It is true that i put pull-up/down on: TEST JTAG_EN, CLKMOD0, CLKMOD1 and IRQ7, which are unnecessary.


---(2)--- QSPI
In the soft Digibutler(ipport.h), if you comment "#define SPI_SOFTWARE 1", QSPI is used (see SD_card.c).

I first used the board "M52233DEMO" on which the QSPI is easily accessible to drive an SD card.
When i received Digibutler i connected the QSPI wires on the microprocessor (not easy).
This solution worked but was too brittle so i opted for a software SPI (slower but strong).

Today, i kept the QSPI (on J13) to manage one or more IO board (IO-EXP-01A) and not overloading the microprocessor.
I did like this in an ARM7 project (IO=SPI hardware, SDcard=SPI soft).
The access to the SD card is an event and in a background task, while IO accesses are in IRQ timer every 5ms.

On Digibutler, 2 boards "IO-EXP-01A" with SPI software consume ~2.8% cpu. It is too much.

That's the reason the SD card is managed with SPI software.

Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 05-12-2009 13:27

Hello,

DigibutlerK3 following

I received PCB from Elektot PCB Service.

After soldering components and a good visual control of the board, i turned on and check alims.
They are correct.
Then i plugged TBLCF to load a software ("ColdFire_Lite_M52259EVB" from website Freescale).
The board does not work: "no connection possible".

... some research time ...

I forgot a pull-up on the XTAL pin to set the operating mode of the oscillator (48MHz).

Problems encountered:
- 10K resistor (pull-up) on XTAL
- 3 components (C2, C3 and R49) prevent the assembly of heatsink on IC2 and IC3


Now I can load the software with TBLCF.
- The serial port works.
- The Ethernet connection also (ping OK).
- The HTTP server responds.


The next step:
It remains to test all the other features:
- Inputs and outputs (TOR, ANA)
- Relay
- SRAM
- Real time clock (with or without external battery)
- SD Card
- USB
- CAN bus


Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 28-12-2009 16:07

Hello,

DigibutlerK3 following

---(1)--- 2009 12 06 Power supply test
Using a power supply 9Vdc 500mA
- 260-290 mA with no cable connected
- 300-340 mA with ethentet link 100M
- 350-380 mA link 100M + USB key
The 5V regulator has to dissipate less than 1/4W
The 3V3 regulator has to dissipate approximately 2.5W
the LF33 RthJC is 3°C/W
by security we take TJ=100° and TA=40°
A heatsink 21°C/W is good

---(2)--- 2009 12 06 Test SRAM
Writing a software for testing SRAM (programming Mini-FlexBus for SRAM "AN3854")
SRAM operates properly without wait state in 8, 16 and 32 bits.
However, i had errors with uart0
- The signal URXD1 connected to J16 is without pull-up: BUG1 we need a resistor.
- If we program UART1, it generates interrupts
- The handler "iuart.c->uart_isr()" identifies an error and invokes "iuart_set_baud()" TO SET THE UART0 BAUDRATE: BUG2
BUG2 exists on "Digibutler" but there is no effect because the UART1 signals are absent.
status: SRAM ok

---(3)--- 2009 12 06 Test RTC
installation showTime and showDate commands.
test with and without external battery (2 AAA batteries)
Vstby must be between 1V8 and 3V5
Istby=5µA when 3V3 is ON
Istby=25µA when OFF
The RTC works properly
status: RTC ok

---(4)--- 2009 12 13 Test SD Card
installation Digibutler software that uses the same signals (DTIN0-3).
no problem, hardware works.
i placed EFSL buffers in extern SRAM: everything works.
when increasing the EFSL cache buffers, it works well if we do not switch off.
Otherwise, there is loss of the last entries.
there is no cache flush after writing (in EFSL).
i temporarily removed the cache. i debug it later.
status: SD card ok (but can be better)

---(5)--- 2009 12 13 Test relay
the output GPT0 activates the relay as expected
status: relay ok

---(6)--- 2009 12 13 Test Camera C328R
mounting C328R on J19 (there is a MIC2026 to switch the power supply)
installation digibutler software
use UART1 instead of UART2
change management of the power suply switching
installation buffers in the external SRAM
everything works well without using main RAM
status: C328R ok

---(7)--- 2009 12 13 Test SPI
connecting an io expansion board "IO-EXP-01A" on J13
installation software from digibutler
but with major change to use the QSPI 10MHz instead of the SPI software.
the process one board with 2 expanders (MCP23S17)
is call every 5 ms and runs 10us (0.2% of CPU)
we can not do better because 10MHz is the maximum of MCP23S17
status: SPI ok

---(8)--- 2009 12 20 Test Camera MCA25
mounting MCA25 on J6 (idem digibutler)
installation MCA25 software from digibutler
only dialogs at 9600 baud runs.
when we change the baurate (460800bauds), dialog stops.
the baurate ERROR is 8.5% with a 80MHz CPU
to have a correct dialog, i changed the CPU frequency to 72MHz (programming the PLL *9)
with this, the baudrate error is 2.34% and remains within the operating range.
status: MCA25 KO with 80MHz CPU clock
status: MCA25 ok with 72MHz CPU clock

i wanted to use 115200bauds (error=1.36% @80MHz) but the mux dialog doesn't run.

can somebody help me to use MCA25 with 115200bauds?
i would like to use MCA25 with 80MHz CPU frequency.

The next step:
- ANA inputs
- USB (i made a good first test)
- CAN bus

DigibutlerK3 files ( CodeWarrior 7.1 project ):
"DigiButlerK3 aaaa mm jj.zip"

sources: http://pagesperso-orange.fr/HLaidet/DigibutlerK3.htm

Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 09-02-2010 08:32

Hello,

DigibutlerK3 following

That's it, i made a standalone Flash programmer.

Features:
- Uses TBLCF with "tblcf.dll"
- Uses OSBDM with "osbdm_cf2.dll" (included on M5229DEMO)
- Algos (and config files) from CodeWarrior
- Can use the files format ELF and format SRecord

We enter the configuration once (it is saved).
- Paths
- Configuration file of the target
- File to send to the target
- Hardware (TBLCF or OSBDM)

There is only one button to:
- Erase Flash
- Program application (ELF and SREC)
- Erase and Program

We can program:
- Digibutler (TBLCF) MCF52231. no necessary because CW is good up to 128kb
- M52233DEMO (TBLCF) MCF52233
- DigibutlerK3 (TBLCF) MCF52259
- M52259DEMO (OSBDM) MCF52259


I wanted to write an HMI easily.
And an efficient "C" code ( reading ELF, SREC...)

Then i choosed "Microsoft Visual C++ 2008 Express Edition"

Note:
- the DLLs you want to use ("tblcf.dll") should be accessible ("system32" or working directory)
- for OSBDM, i didn't upgrade firmware on M52259DEMO then "osbdm_cf2.dll" is used
if you want to use newer version, you have to edit "BDMinterface.cpp"
and change 15x[DllImport("osbdm_cf2.dll")] by your dll name.

Next step:
porting software to IDE eclipse (galileo) and Codesourcery m68k

sources: http://pagesperso-orange.fr/HLaidet/H_Flasher.htm

Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 30-03-2010 20:22

Digibutler new adventure

Hello,

DigibutlerK3 following

I decided to use "MQX" (present in eval board package from Freescale) as a starting point.
The reason for choosing "MQX" is:
- all source codes are present (no library).
- important documentation
- many examples
- Freescale installs MQX on multiple platform
to conclude the product is alive.

---(1)--- 2010 02 11 Eclipse GCC MQX
installation the latest version (galileo) Eclipse IDE for C/C++
- "Eclipse-cpp-galileo-SR1-win32.zip"
installation GCC from CodeSourcery
- "Freescale-coldfire-4.4-52-m68k-elf.exe"
installation MQX 3.5
- "FSLMQXOS_3_5_0.exe"

Eclipse structure:
- creation of a workspace (ex:"Kirin3")
- project application (ex:"DigiK3_MQX")
- project library "MQX_LIB"
- project library "MFS_LIB"
- project library "RTCS_LIB"
- project library "SHELL_LIB"
- project library "USB_LIB"
- an empty project "LIBRARY" containing all the libraries in one "libHLA.a"
because "m68k-elf-gcc" linker has problems with references in standard library

to import a project archive:
- create an empty workspace
File->Switch Workspace->Other
- File->Import...
- General->Existing Projects into Workspace->Next
- Select archive file->Browse : "ExportKirin3 aaaa mm dd.zip"
- Select All->Finish

---(2)--- 2010 03 01 MQX and gcc
MQX kernel OK
MQX shell OK
MQX mfs OK
MQX rtcs OK
MQX usb_host OK after some difficulties
- in "mcf5225.h" filler alignment wrong (fixed in MQX 3.5.1)
- in "host_dev_list.c" do.while bad "C" writing. never exit when compiled with optim (it's a bug in gcc)
the TCP/IP RTCS seems to be more effective than "NicheLite".
by analyzing with "Wireshark" the flow of a TCP/IP basic client/server,
at the client's question, "NicheLite" sends an ACK frame and after,
the response data frame (same as "OpenTcp" stack).
RTCS sends a single frame with datas and ACK.

---(3)--- 2010 03 07 SD Card
writing spi driver software (DTIN0-3)
installation "SD_card" soft
MQX mfs with USB and/or SD_card OK

---(4)--- 2010 03 13 RAM 512kb
adapting the code to drive the RAM with "MiniFlex Bus"
modified "H_Flasher" to download and execute code in RAM
Adding "Dhrystone Benchmark Program V2.1" by Reinhold P. Weicker
test in Flash and RAM for program better "MiniFlex Bus"
Flash/RAM =12.9 with FB_CLK=40MHz and 0 wstate
Flash/RAM = 8.8 with FB_CLK=80MHz and 1 wstate (0 is not allowed at 80MHz)
now we can test the code without reprogramming the flash
we only have to change "rom(RX)RIGIN=0x00000000" to "rom(RX)RIGIN=0x10000000"
in "intflash.lcf" to generate the code for Flash or RAM
adding a 128kb Ramdisk (for camera soon)

---(5)--- 2010 03 14 RTC
adding shell functions "date" and "time"

---(6)--- 2010 03 20 Extension IO_EXP_01A
writing process to drive "IO_EXP_01A" with QSPI (J13)

---(7)--- 2010 03 28 Erratic operation
the application was functioning erratically.
after searching hard, i finally found it.
it is a difference with the CW and GCC compiler.
in "Dispatch.s" when saving the context (macro SAVE_ALL_REGISTERS),
registers A0,A1,D0,D1 and D2 are omitted (optimization).
it is well with Codewarrior but GCC uses only A0,A1,D0 and D1 as scratch registers.
it is therefore necessary to add D2 when saving the context.

---(8)--- 2010 03 30 CAMERA C328R
in progress
it works but without preview mode


DigibutlerK3 files ( Eclipse "C" project ):
"ExportKirin3 aaaa mm jj.zip"

sources: http://pagesperso-orange.fr/HLaidet/DigibutlerK3.htm

Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 22-09-2010 19:47

Hello,

DigibutlerK3 following

... a long time ... but i wake up ...

i wanted to use DigibutlerK3 like a CAN bus analyser

---(1)--- 2010 09 17 FlexCAN
install a process for monitoring CAN bus
- Reading messages from FlexCAN (IRQ process)
- Each message is dated to the microsecond and pushed in a FIFO
- Adding a server to dialogue with a client ("H_CANdiag)

write a client ("H_CANdiag") for reading and displaying CAN messages


"DigibutlerK3" is the low level engine, who reads every messages,
dates ( microseconds ) and stores them in a Fifo

"H_CANdiag" is the user interface that allows to:
- start sampling
- read and display all CAN messages dated
- use a trigger (ID / DLC / DATAS) to stop sampling
- save messages in a text file

sources: http://pagesperso-orange.fr/HLaidet/DigibutlerK3.htm

Greetings, Henri

SATP

1 post

Popping In
Popping In

Read post 12-10-2010 09:43

Hello,

I am working on MCF52259 which interfaces with TJA1050 CAN XCVR.
Query about this is MCF52259 has 3.3VCC & TJA1050 has 5V VCC. But in your schematic you interfaced directly, as MCF52259 is not 5V tolerent. Are you getting any issues with this?


Greetings, SATP

Post edited by SATP on 12-10-2010 09:48

Post edited by SATP on 12-10-2010 09:51

Post edited by SATP on 12-10-2010 09:53

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 12-10-2010 23:17

Hello SATP,

DigibutlerK3 schematic:
- The input CANRX of MCF52259 is connected to TJA1050 through a 1k resistor.
- The output CANTX is connected directly because TJA1050 accepts the 3V3 input level.

We can read in Datasheet "MCF52259DS.pdf" section Maximum Ratings:
- All functional non-supply pins are internally clamped to VSS and VDD(3V3).
- Input must be current limited to the IDD(25mA) value specified.

Then, with 1k resistor, the maximum current is less than 2mA.

For me, it runs correctly.

Greetings, Henri

HLaidet

61 posts

Frequent Visitor
Frequent Visitor

Read post 02-12-2010 00:36

Hello,

DigibutlerK3 following

---(1)--- 2010 11 28 CANopen
Installation CANopen Slave
porting the stack CanFestival (Stack free licensed with LGPL Mr. Edouard TISSERANT)
This stack can work to any microcontroller there are example AT91, AVR, HCS12.
The stack requires a driver CAN (hardware-specific) and a driver TIMER
- Writing driver for FlexCAN
- Using PIT1 1ms
Soft in directory "CANopen\source"
- EDS (Electronic Data Sheet) file in "CANopen\Dictionary"
- The current version is 16 Digital Inputs + 16 Digital Outputs + 4 Analog Inputs(16 bit)
activated or not with the #define APPCFG_ENABLE_CANOPEN

If 16 Digital I/O + 4 Analog Inputs are not enough for you,
CanFestival permits you to build your own EDS file and generate the Object Dictionary.
Personaly, i prefer using CANeds (freeware) to build EDS file (better checking mode).
After building EDS file, i use "objdictedit.py" to generate the ObjDict from the EDS file.
It generates 2 files "ObjDict.c" and "ObjDict.h" we need to compile and link with the application.

At the begining of "CANopen_Task", a call to "CANopen_RemapIO()" redirects the addresses in an interface easy to use.

Next step: CANopen Master

sources: http://hlaidet.pagesperso-orange.fr/DigibutlerK3.htm

Greetings, Henri

Please log in to post a reply or subscribe / unsubscribe to topics

Subscribe now

Subscribe to our free
E-weekly Newsletter!

Enter your Email address:

Follow Elektor

      

Act now!

FAQ

Before submitting questions, review our FAQ section!

Bestseller

Microprocessor Design using Verilog HDL

This book is a practical guide to processor design in the real world. It presents the Verilog HDL in an easily digestible fashion and serves as a thorough introduction about reducing a computer architecture and instruction set to practice. 

Package Deals

Elektor Bundles

Check our Package Deals and save money! Discounts up to 19% now available!

Price Slashed

Elektor OSPV

This Open Source People Vehicle is perfect for factory halls, warehouses, hospitals, colleges, schools etc.

Elektor PCBs at 25% OFF