cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S-Discovery for Linux

jark
Associate II
Posted on February 09, 2010 at 00:19

STM8S-Discovery for Linux

#linux-usb-stm8s
9 REPLIES 9
patocheham2
Associate
Posted on May 17, 2011 at 15:07

Hello

Yes, the OS is windows, you can try to use raisonance There is free 16KB version available. I heard the Raisonance would extend their free version to larger memeory size in the coming weeks.

Cosmic is usually pretty stable. What is the version OF the OS, Have you posted a request on cosmic support?

Alexander Czajor
Community manager
Community manager
Posted on May 17, 2011 at 15:07

James,

the STM8S discovery uses the standard ST toolchain. STVD and STVP. I guess in your approach you would need a linux version of STVP. Have to check whether this exists ...

Ciao

Alex

horst23
Associate
Posted on May 17, 2011 at 15:07

Hi Alex,

can you please give me a short info too, if you find something suitable for linux. I'm working with Ubuntu.

Thanks

Horst

arnd-hendrik
Associate
Posted on May 17, 2011 at 15:07

Hi Alex,

Have you found out anything, yet? I'm searching for a way to debug the STM8S-Discovery on Ubuntu, too, and I'm glad to have no Win-Boxes around me.

I've tried to use the STVD debugger via Wine, but (somewhat expectedly) I only get

''Connection error (usb://usb): swim error [30200]: st-link connection error''

So I'd love to test a native Linux version, too, if there is any available.

A.-H.

vaclav23
Associate II
Posted on May 17, 2011 at 15:07

Hi, I am interested in linux design flow as well. I tried to plug the STM8-Discovery board into my Ubuntu. The mass storage device is somehow detected. But each state change of the LED (on->off, off->on) caused to generate some USB error in the /var/log/messages file.

I will have a look on it later. But that might be the problem why programming end with ''Connect error''.

jark
Associate II
Posted on May 17, 2011 at 15:07

Hi guys,

    The solution I have found is not completely satisfactory - but it works well.  I've installed a Windows XP virtual machine using VirtualBox.  The STVD package and its USB interface works properly with the STM8S-Discovery module and I can compile and debug flawlessly.  A proper Linux IDE would be nicer but this does work!

vaclav23
Associate II
Posted on May 17, 2011 at 15:07

Hi, the /var/log/messages is below. I don't know if it helps anybody to decide what is wrong. But it seems to me that there is some discrepancy between USB implementation in linux kernel and in STM32 debugger. I still don't have usbmon installed on my Ubuntu Jaunty, but somebody else here might have.

Jul 28 07:53:04 supermuf kernel: [50410.844048] usb 5-1: new full speed USB device using uhci_hcd and address 2

Jul 28 07:53:04 supermuf kernel: [50411.013329] usb 5-1: configuration #1 chosen from 1 choice                

Jul 28 07:53:04 supermuf kernel: [50411.234429] Initializing USB Mass Storage driver...                       

Jul 28 07:53:04 supermuf kernel: [50411.236944] scsi2 : SCSI emulation for USB Mass Storage devices           

Jul 28 07:53:04 supermuf kernel: [50411.237309] usbcore: registered new interface driver usb-storage          

Jul 28 07:53:04 supermuf kernel: [50411.237316] USB Mass Storage support registered.

Jul 28 07:53:09 supermuf kernel: [50416.240871] scsi 2:0:0:0: Direct-Access     STM32                          PQ: 0 ANSI: 0

Jul 28 07:53:09 supermuf kernel: [50416.292869] sd 2:0:0:0: [sdb] 64000 512-byte hardware sectors: (32.7 MB/31.2 MiB)

Jul 28 07:53:09 supermuf kernel: [50416.295868] sd 2:0:0:0: [sdb] Write Protect is on

Jul 28 07:53:09 supermuf kernel: [50416.416061] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:10 supermuf kernel: [50416.680056] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:10 supermuf kernel: [50416.944041] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:10 supermuf kernel: [50417.208047] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:10 supermuf kernel: [50417.472047] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:11 supermuf kernel: [50417.756047] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:11 supermuf kernel: [50417.907476] sd 2:0:0:0: [sdb] 64000 512-byte hardware sectors: (32.7 MB/31.2 MiB)

Jul 28 07:53:11 supermuf kernel: [50417.910463] sd 2:0:0:0: [sdb] Write Protect is on

Jul 28 07:53:11 supermuf kernel: [50417.910480]  sdb:

Jul 28 07:53:11 supermuf kernel: [50418.036063] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:11 supermuf kernel: [50418.300058] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:11 supermuf kernel: [50418.564306] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:12 supermuf kernel: [50418.832051] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:12 supermuf kernel: [50419.096051] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:12 supermuf kernel: [50419.360043] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:12 supermuf kernel: [50419.508121] sd 2:0:0:0: [sdb] Attached SCSI removable disk

Jul 28 07:53:12 supermuf kernel: [50419.508248] sd 2:0:0:0: Attached scsi generic sg2 type 0

Jul 28 07:53:13 supermuf kernel: [50419.812053] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:13 supermuf kernel: [50420.080049] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:13 supermuf kernel: [50420.344048] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:13 supermuf kernel: [50420.608064] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:14 supermuf kernel: [50420.872044] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:14 supermuf kernel: [50421.136043] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:14 supermuf kernel: [50421.428041] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:15 supermuf kernel: [50421.692055] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:15 supermuf kernel: [50421.956048] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:15 supermuf kernel: [50422.220133] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:15 supermuf kernel: [50422.484047] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:16 supermuf kernel: [50422.764044] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:16 supermuf kernel: [50422.910349] sd 2:0:0:0: [sdb] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK

Jul 28 07:53:16 supermuf kernel: [50423.028048] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:16 supermuf kernel: [50423.292059] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:16 supermuf kernel: [50423.556039] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:17 supermuf kernel: [50423.824056] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:17 supermuf kernel: [50424.088060] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:17 supermuf kernel: [50424.356051] usb 5-1: reset full speed USB device using uhci_hcd and address 2

Jul 28 07:53:18 supermuf kernel: [50424.932110] sd 2:0:0:0: [sdb] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK

Jul 28 07:53:18 supermuf kernel: [50424.932280] usb 5-1: USB disconnect, address 2

Jul 28 07:53:18 supermuf kernel: [50424.934701] sd 2:0:0:0: [sdb] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK

Jul 28 07:53:18 supermuf kernel: [50424.934829] sd 2:0:0:0: [sdb] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK

Jul 28 07:53:18 supermuf kernel: [50424.935645] scsi 2:0:0:0: [sdb] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK,SUGGEST_OK

Jul 28 07:53:18 supermuf kernel: [50424.935667] scsi 2:0:0:0: [sdb] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK,SUGGEST_OK

vaclav23
Associate II
Posted on May 17, 2011 at 15:07

I had another idea. From www.usb.org I downloaded USB compliance tester. It looks that STM32 USB firmware is not fully compatible with Mass Storage Class specification. Below is just the part of a log file. I don't know if it is somehow related to the problem on Linux. But probably yes. If Linux gets less data then expected, it resets the USB device - that is why there is a plenty of resets.

Is there any STM32 firmware update which corrects the belowmentioned problems ? Then there is a possibility to have functional STM32 debugger on Linux.

Thank you.

===============

Test log initialized.

User Input module initialized

Microsoft Windows XP (Build 2600)

Service Pack 3.0

USBCommandVerifier.dll ver 1.4.2.3

TestServices.dll ver 1.4.2.3

StackSwitcher.dll ver 1.4.2.3

===============

Now Starting Test: USB Mass Storage Serial Number Test (Configuration Index 0)

Start time: Wed Jul 28 11:00:25 2010

Serial Number string for MSC device : iSerialNumber = 0x3

ENGLISH_US language string descriptor is : 4

Using Language ID 0x409

MSC Serial Number length = 26

MSC Serial Number length = 26

MSC Serial Number string descriptor type = 0x3

MSC Serial Number length = 26

MSC Serial Number string descriptor type = 0x3

MSC Serial Number character [0] = 0x34

MSC Serial Number character [1] = 0x0

Invalid MSC Serial Number character

*************************

Invalid MSC Serial Number character

*************************

*************************

(5.1.3) Serial number characters must be 0x0030-0x0039 or 0x0041-0x0046.

*************************

.

.

.

===============

Now Starting Test: USB Mass Storage Power Up Test (Configuration Index 0)

Start time: Wed Jul 28 11:00:49 2010

Attempting to re-enumerate device

Device has been re-enumerated, perform PowerUp test

Configuring device, set configuration = 0x1

NOTE: It is expected the device has reset the data toggles on all Bulk endpoints after the above SetConfiguration call

Setting device interface, interface number = 0x0 and alternate setting = 0x0

NOTE: It is expected the device has reset the data toggles on all Bulk endpoints after the above SetInterface call

Issuing Get Max LUN request

Max LUN value = 0

Getting Device Type

Issuing INQUIRY

Issuing CBW (attempt #1):

|----- CBW LUN = 0x0

|----- CBW Flags = 0x80

|----- CBW Data Transfer Length = 0x24

|----- CBW CDB Length = 0x6

|----- CBW CDB-00 = 0x12

|----- CBW CDB-01 = 0x0

|----- CBW CDB-02 = 0x0

|----- CBW CDB-03 = 0x0

|----- CBW CDB-04 = 0x24

|----- CBW CDB-05 = 0x0

Issuing DATA IN

Issuing CSW : try 1

*************************

Expecting a STALL after data phase completes with a zero-length or short packet

*************************

If the device actually transfers less data than the host indicated, the device shall STALL the Bulk-In pipe

CSW residue returned = 0x13

CSW status returned = 0x0

Failed INQUIRY request, returned 17 bytes of data and expected 36

(5.7.1) All devices must support the commands marked as required in 4.2 based

on PDT. Devices that support all the commands marked as required for Bootable devices will

be reported as Bootable.

Failed PowerUp test

(5.8.1) The interface shall be capable of responding to commands without

failure immediately following configuration.

Unconfiguring the device

Stop time: Wed Jul 28 11:00:58 2010

Duration: 9 seconds.

Stopping Test [ USB Mass Storage Power Up Test (Configuration Index 0):

Number of: Fails (2); Aborts (0); Warnings (1) ]

**

Device is NOT considered compliant with the Bootability specification.

**

Summary Log Counts [ Fails (17); Aborts (0); Warnings (24) ]

simonqian2
Associate II
Posted on May 17, 2011 at 15:07

I have added in Versaloon support to STM8_SWIM.

The command line program of Versaloon is compiled using GCC(with autotool).

The GUI program is compiled using Lazarus, which is multi-platform compiler.

The firmware can be compiled using CodesourceryG++, but IAR EWARM KickStart is recommended.

Check below:

http://www.simonqian.com/en/Versaloon/

There is also information about using Versaloon in STM8S-Discovery(in japanese):

http://nemuisan.blog.bai.ne.jp/?eid=171026

But note that, you will destory original st-link in STM8S-Discovery.