USB Stack (Host & Device) with single port

 We are making ECR (Electronic Cash Register)(billing Machine) with NXP uC (ARM7  & Cortex M4). The existing product is very much stable and in running production.
Now for cost effectiveness we are migrating (One of our base Model)  to Renesas with synergy S3A3, 100-pin (Flash: 512KB,     SRAM: 96KB(R7FS3A37A3A3A01CFP). 
As per existing features in our model we want to achieve the same with  following:-  
A)     Internal  Memory (SRAM)  for data storage only  upto   51KB    ; to achieve this(for data retention) a dedicated battery backup is provided  with deep standby mode implementation
B)     USB interface with host and device. At a time only one mode will be used. For this we have implemented  a switching IC  for changeover. 
       As in existing algorithm (for NXP) we have not used OTG feature, so here we will  also avoid this .
C)   We are avoiding multiple threads  using e2studio so as to avoid complexity  during migration from previous (NXP) code.
For  S3A3 we have done with basic functionality of uC initialization, timers, RTC, ADC, SCI  using SINGLE thread
 D) for USB interface , we need in HOST mode : Mass storage interface  and simple HID device connectivity .
                                                   In DEVICE mode:  as HID connectivity with PC.
       So from above mentioned three interfaces,  only one  will be operational at a time that will be handled by our code logic with hardware switching IC.
This has been already implemented effectively  in our existing product using NXP.
We have tested (in S3A3) USB interface as HOST and DEVICE individually  .  But in Host mode for MSD , only FILEX framework is consuming around 65KB. Rest for DEVICE interfaces are taking upto 19KB .
SO how we can implement all three interfaces with common memory pool size (if possible within 20KB) considering  at a time only one interface be operational??
  • Hi bab,

    How are things going so far? It seems that no one yet responded to this query. Have you already figured out this one?

    RenesasRulz Forum Moderator

  • In reply to JB:

    Not yet. It is still unresolved. I have got some idea from other sources to reduce memory usage by disabling some features but which one I have no idea. And no any clue to use same memory pool size for all the three interfaces.
  • Does anybody have any clue to implement this?
  • In reply to bab:

    Hi Bab-
    In the USBX on ux module there is a Pool Memory Name- is it the same for both Host and Device? Have you tried adjusting the size of the memory pool.

    Note that according to this post

    additional memory may be required, depending on your application. In your case, if only one USB port is running at a time you might be OK. Will require testing.

    Let us know your thoughts..
  • In reply to WarrenM:

    As in S3A3, only one USB controller is present. How to implement Host (mass storage) as well as Device(HID) with common memory pool size considering only one operation (either as host or device) will be active at a time. The additional hardware(in our customized board) has been implemented for switching b/w device and host lines and will be managed by our software algorithm. And It is already implemented our existing designs using NXP uC.

    So my simple question (I am trying to make you understand from couple of months) , if Host and device frameworks are implemented individually and work properly, then how to implement the both in single project (having single port in uC)
    keeping the memory pool common for both (considering only one operation at a time).