MSC + CDC Composite device example (STM32F3 Discovery)

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
geoffrey.brown
Posts: 87
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 15 times

Re: MSC + CDC Composite device example (STM32F3 Discovery)

Postby geoffrey.brown » Fri Oct 13, 2017 8:57 pm

I did integrate your changes in my repo, so I'll be interested to hear if you track down the reboot problem. A small note to those who follow --
the hal_usb_msd.c file in ChibiOS-Contrib assumes that the target has usb otg. I had to make my own version of this file with the offending lines commented out. I don't really know if this causes other problems.

Geoffrey
Last edited by geoffrey.brown on Fri Oct 13, 2017 9:09 pm, edited 1 time in total.

User avatar
kimmoli
Posts: 27
Joined: Sat Oct 01, 2016 8:02 pm
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: MSC + CDC Composite device example (STM32F3 Discovery)

Postby kimmoli » Fri Oct 13, 2017 9:09 pm

Yep. I need it to stay up infinitely.

The board is at office on my desk, but by wonders of remote computing i can see it has been up and running since i left. During the day it rebooted twice in a short period / in a row, and then stayed up for a few hours.
Now it has been up for 6 hours.

Or maybe it was me doing something that caused reboots. dunno.

User avatar
HDKLog
Posts: 41
Joined: Thu Aug 18, 2016 12:36 am
Been thanked: 2 times

Re: MSC + CDC Composite device example (STM32F3 Discovery)

Postby HDKLog » Wed Jan 17, 2018 8:08 am

kimmoli wrote:I need to study this a bit more, the board surprise-reboots a few times per day.
I have most of CH_DBG_* on and no watchdog active, but still it just reboots.


Looks like memory access violations and memory corruption bug, ChibiOS can't debug it (correct me if I'm wrong). I will recommend you to check operation on arrays and memory blocks.

I saw your pull request and found something interesting:

Code: Select all

typedef struct PACKED_VAR {
  uint8_t peripheral;
  uint8_t page_code;
  uint8_t reserved;
  uint8_t page_length;
  uint8_t serianNumber[8];
} scsi_unit_serial_number_inquiry_response_t;


Code: Select all

static const scsi_unit_serial_number_inquiry_response_t default_scsi_unit_serial_number_inquiry_response =
{
    0x00,
    0x80,
    0x00,
    0x08,
    "00000000"
};


C style string "00000000" ocupate 9 bytes, not 8 because special '\0' placed at the end by compiler. Does serianNumber need to be C style string? if so, then you need to paste one less '0' character, if no then code below will be more correct way:

Code: Select all

static const scsi_unit_serial_number_inquiry_response_t default_scsi_unit_serial_number_inquiry_response =
{
    0x00,
    0x80,
    0x00,
    0x08,
    '0', '0', '0', '0', '0', '0', '0', '0'
};

User avatar
kimmoli
Posts: 27
Joined: Sat Oct 01, 2016 8:02 pm
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: MSC + CDC Composite device example (STM32F3 Discovery)

Postby kimmoli » Sun Feb 04, 2018 11:18 am

hmh, i just rechecked SCSI spec, and looks like the serial number is all wrong.

And if no serial numbers, it should be spaces.

Just wondering what does " both parameters " refer to...

The PAGE LENGTH field specifies the length in bytes of the product serial number page. Older products that only support the Product Serial Number parameter will have a page length of 08h, while newer products that support both parameters will have a page length of 14h. If the ALLOCATION LENGTH is too small to transfer all of the page, the page length shall not be adjusted to reflect the truncation.
The Product Serial Number field contains ASCII data that is vendor-assigned serial number. The least significant ASCII character of the serial number shall appear as the last byte in the Data-In Buffer. If the product serial number is not available, the target shall return ASCII spaces (20h) in this field.


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 1 guest