Hi,
I'm using an MCF51JM64 (can change to 128 if need be). I want to implement USB slave functionality with a CDC class. Does anyone know if there is a step by step guide for doing so? I've downloaded appnotes AN3492, 3560 and 3565 and they all seem to be more of a reference document. They make it seem like hard work.
Regards
Ef
I have some problem. CMX lite only have limit endpoint. How change and add bidiction endpoint?
Hi Hao, I managed to get it working. It enumerates as a USB virtual COM port on the PC so you can use HyperTerminal to talk to the JM128 embedded product (in this case a lighting controller I'm developing).
Cheers
Ef
Hey Ef,
I'm trying to work through it on an M52223EVB with CW 7.2 to implement a CDC device.
A big part of the problem is that the CMX code uses their own register definitions along with very specific data address constructs.
It's a great learning exercise to try and work through it, but I'm wondering if there's an easier way.
Anybody have any ideas?
myke
Thanx, I'm looking through it right now.
I'm still interested in getting the source code to a CDC stack, so if anybody can point me to it, I would appreciate it.
myke
Hi Myke,
Here's a note I wrote and circulated to my clients outlining how to port CDC CMX into a V1 Freescale. It hasn't got all the details in each step but does have every step outlined. Have a look and see if it works for you. I can supply the details off line if required (ef@electronicsbydesign.com.au)
Regards
Ef
Hey Ef,
Thanx for the link. You've approached the issue in exactly the same way that I have (I started with simply implementing a UART interface and now that the other software is working, I'm doing the USB) with many of the same issues that you seem to have had (I'm also working with the same basic files with the exception of register declares, as noted below).
A couple of questions, I was going to ask off line, but they might be of use to others on the list:
1. What version of CW are you using? I would like to use 7.2 (the latest) rather than 6.3 which the CMX documentation (and apparently the code) was written around.
2. I think there's a typo in the attached design notes, the apnote is 3492 and not 3462 as quoted in it.
3. What did you do about register declarations? The code uses a file called "mcf5222x_reg.h" rather than "mcf52223.h" that was provided by Freescale. I've been reworking the various USB files to use the Freescale declarations rather than support two different sets of register declares.
4. For the BDT declaration, I've modified the .lcf files to include:
___bdt_size = 0x200;
with heap & stack size declarations as well as modifying the ".custom" declaration to:
.custom :
{
___HEAP_START = .;
___heap_addr = ___HEAP_START;
___HEAP_END = ___HEAP_START + ___heap_size;
___SP_END = ___HEAP_END;
___SP_INIT = ___SP_END + ___stack_size;
___BDT_END = ___SP_INIT;
___BDT_BASE = ___BDT_END + ___bdt_size;
. = ALIGN (0x200);
} >> userram
with the declare statement:
__BDT_BASE = ___BDT_BASE;
added later. Everything seems to make correctly,but during linking I'm getting an error message:
'All segments to userram have to begin at address aligned to 512
Please add ".=ALIGN(512);" before every "} >> userram"'
What should I be doing here to fix the problem, I've tried to add a few of these statements, but I continually get error messages? Is there anything else that should be done?
As I'm using CS 7.2, I would like to use Processor Expert (PE) and part of this is trying to figure out the right way of doing the USB initializations. Has anybody done this successfully? I want to use PE to avoid having two hw initializations which may interact badly and being able to put in the USB interrupt handler directly without having to modify the functions directly.
Thanx for your help & suggestions!
myke
Hi Myke,
1. I'm using 6.2
2. Thanks Done.
3. I included the _reg.h file the CMX drivers use as well as the one PE generates. They are actually pretty much the same (almost identical). It doesn't have any impact on code size and it doesn't look as nice but hey it works.
4. Attached is my LCF file (extension changed to .txt to get through this forum's requirements on extensions). If you are using PE you need to go into the CPU bean and under the tab "Build Options" (next to Methods, Events etc) change the setting "Generate LCF File" to NO and then include the changes you can see in my LCF. The error message you get is a warning.... not an error. I get the same and just ignore it and everything works fine including USB and my application code.
5. I didn't use PE to initialise USB so no interaction issues were encountered. Just let CMX do it and don't worry about PE for USB. Not as elegant but it works.
hope that works
Regards
Ef
Hey Ef,
Almost there - so close I can smell it.
Should I be updating interrupt vector 0x69 or 0x75? In your Design Notes, you indicate that it's "vector 69", but when I look at the CMX code, it looks like it should be 0x75 (117d).
When I plug in the USB, the device comes up as "unknown" (which is what I was expecting). But when I try to install mcf5222x.inf from the CMX library, I get the message "The folder you specified doesn't contain a compatible software driver for your device. If the folder contains a driver, make sure it is designed to work for Windows for 32-bit systems."
Any ideas? I'm running Windows 7 on the development PC. I'll also follow up with CMX.
Thanx - your guidance is really appreciated,
myke
Hi Myke,
The JM128 was definitely vector 69. Your micro is a V2 or something else and will not be 69, so I guess it must be 75
You need to enumerate with a Windows XP machine. I had trouble with 2000 but never tried 7. The enumeration should just work.
Good luck with CMX!!! I tried them and they said they don't support it because it's the Lite stack which they wrote for Freescale and they support it. CMX only support the full blown stack you can buy off them
Good luck
Ef
Hey Ef,
It seems to work great on an XP machine (I'm still kind of in shock).
The CMX stack is turning into a bit of a bait and switch. I think that for the robot, if we make it into a product we'll have to buy the stack from them to get full support on the various flavours of Windows (although I'm expecting to make sure it works on a Mac and on a Linux machine because of what they charge).
Thanx for all your help!
myke
Actually it' probably not the stack that's the issue with Win 7 - more likely the driver (.INF file)
Hi Ef,
I'm going to be talking to my FAE in the next couple of days on ColdFire issues - I'll add that to the list and let you know what I hear.
Again, thanx for all your help,
myke
Hi Myke,
Good to hear it worked. Ask Freescale if they will release a Win 7 version of the stack? When you find out, let me know as it's an issue I'll need to cross as well.
Cheers
Ef
Hi Myke
You can also look at the CDC device support in the uTasker project: http://www.utasker.com/kirin3.html
This runs on all Coldfire V2s with USB.
This is of particular interest for study purposes due to the fact that the USB operation can be simulated in the uTasker simulator, which makes learning and development much easier than working with hardware (USB is not the easiest thing in the world to debug...;-)
Furthermore, it is proven in industrial projects, can support MODBUS via USB CDC and requires less code than most other solutions - a complete Kirin3 project with web server, TELNET, FTP, etc. internal file system, SD card FAT32, USB CDC, SW upload support via FTP, HTTP post or USB requires about 100k, including test applications).
The next release should include USB mass storage so that an SD card connected to the processor via QSPI can be seen like a memory stick from the PC host. The SD card can also be used by the application at the same time for logging functions (FAT32 file system with long file name support) and/or for web pages etc (Kirin3 with Ethernet).
Regards
Mark