USBB of AT32UC3B0512 IS NOT communicating after first sending one byte.

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Guys hope you all are fine and healthy, i was working on interfacing usbb with computer, i want to used usb port on stk600 kit, I am using ASF exmaples present in atmel studio seven but communication is not happening perfectly, i am gonna attach the code part where i feel there is some issue, 

 

void device_template_task(void)
#endif
{
  static U8 buf[EP_SIZE_TEMP2];

#ifdef FREERTOS_USED
  portTickType xLastWakeTime;

  xLastWakeTime = xTaskGetTickCount();
  while (true)
  {
    vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DTP_PERIOD);

    // First, check the device enumeration state
    if (!Is_device_enumerated()) continue;
#else
    // First, check the device enumeration state
    if (!Is_device_enumerated()) return;
#endif  // FREERTOS_USED

    // HERE STARTS THE USB DEVICE APPLICATIVE CODE
    // The example below just performs a loopback transmission/reception.
    // All data received with the OUT endpoint is stored in a RAM buffer and
    // sent back to the IN endpoint.

#if BOARD == EVK1100
    // For example, display Start-of-Frame counter on LEDs
    LED_Display_Field(LED_MONO0_GREEN |
                      LED_MONO1_GREEN |
                      LED_MONO2_GREEN |
                      LED_MONO3_GREEN,
                      sof_cnt >> 5);
#elif BOARD == EVK1101 || BOARD == UC3C_EK || BOARD == EVK1104 || BOARD == EVK1105
    // For example, display Start-of-Frame counter on LEDs
    LED_Display_Field(LED0 |
                      LED1,
                      sof_cnt >> 5);
#else
  #error The display of the SOFs must be defined here.
#endif

    // If we receive something in the OUT endpoint, just store it in the RAM buffer
    if (Is_usb_out_received(EP_TEMP_OUT))
    {
      LED_On(LED_APPLI_1);
      Usb_reset_endpoint_fifo_access(EP_TEMP_OUT);
      data_length = Usb_byte_count(EP_TEMP_OUT);
      usb_read_ep_rxpacket(EP_TEMP_OUT, buf, data_length, NULL);
      Usb_ack_out_received_free(EP_TEMP_OUT);
      LED_Off(LED_APPLI_1);
    }

    // Load the IN endpoint with the contents of the RAM buffer
    if (data_length && Is_usb_in_ready(EP_TEMP_IN))
    {
      LED_On(LED_APPLI_0);
      Usb_reset_endpoint_fifo_access(EP_TEMP_IN);
      usb_write_ep_txpacket(EP_TEMP_IN, buf, data_length, NULL);
      data_length = 0;
      Usb_ack_in_ready_send(EP_TEMP_IN);
      LED_Off(LED_APPLI_0);
    }
#ifdef FREERTOS_USED
  }
#endif
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aasimizia wrote:
interfacing usbb (sic?) with computer

What is "USBB" ?

 

aasimizia wrote:
communication is not happening perfectly

So in what way(s), exactly, is it "imperfect"?

 

What debugging have you done?

 

What have you found?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have checked on terminal software on pc, when i send a byte i get that byte loop backed but only once, even though my code is in while(1), it should work continiously, USSB is usb bus protocol in this controller mentioned in post.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, that's just more confusing.

 

Please remember that we can't see what you're doing - we rely entirely upon you providing clear, complete, and accurate descriptions.

 

The more effort you put into making a good question, the more likely you are to get a good reply!

 

aasimizia wrote:
when i send a byte

Which end is sending - the terminal?

 

i get that byte loop backed but only once, even though my code is in while(1), it should work continiously

So what have you done to debug this?

 

Think about what could cause this; eg,

  • The PC stops transmitting;
  • The microcontroller stops receiving;
  • Your code stops recognising received bytes;
  • The microntroller stops sending the bytes;
  • etc, etc, ...

 

Debugging is all about finding what's happening, finding the cause, and then fixing it.

 

See: https://www.avrfreaks.net/comment...

 

And: https://www.avrfreaks.net/comment...

 

 

USSB (sic) is usb bus

No.

 

USB = Universal Serial Bus; you don't need an extra 'B' - the 'B' that's already there is for "Bus"

 

https://en.wikipedia.org/wiki/USB

 

 

EDIT

 

Ah - so "USBB" is actually the name of the USB controller within the chip.

 

So perhaps the 2nd 'B' is for "Block" ... ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Jan 22, 2018 - 03:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The AT32UC3B0512 has on-chip debug - use it!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

let me explain it completely first. I am using stk600  kit for programming, using mini usb port present on stk kit. I am using usb as a CDC, and its detected in my device manager as a com port that means usb control endpoints are working. The code i have added is just for loop back when i send data from hyperterminal software present in PC, usb should loop back the byte and it does for once only. As far as debugging is concerned how can i do on chip debugging bcoz i am new with 32 bit microcontroller, i have worked with 8 bit microcontrollers which were easily simulated but this one isnt.

Can you check it out in example, its basically an example project that is not working the way they say it should work.

how to check that PC stopped transmitting or not?

Looks like my controller stops recognising, when i reset it , it works again for once.

Ask me i will explain everything, bcoz i am new to the forum so i dont know what details should be provided to get the best answer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

links you have given are of usart, I hve worked with serial it was fine, only usb is causing issues

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aasimizia wrote:
i am new with 32 bit microcontroller

So why did you choose AVR32?

 

See: https://www.avrfreaks.net/comment...

 

But using the on-chip debug is no different from doing it on an 8-bit processor.

 

links you have given are of usart

No, they aren't - they are about general debugging techniques & approaches.

 

eg, you can use the USART to instrument your code to help in your debugging...

 

Exactly as on an 8-bit chip.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it is boss's requirement, he wants me to get familiar with 32 bit thats why, i have done debugging usb LED on board to check where my code goes, it doesnt go to the loop where i am reading data. it should go but it doesnt for second time