{"id":383,"date":"2017-11-24T21:52:43","date_gmt":"2017-11-24T20:52:43","guid":{"rendered":"http:\/\/mikrocontroller.bplaced.net\/wordpress\/?page_id=383"},"modified":"2020-08-16T23:27:56","modified_gmt":"2020-08-16T21:27:56","slug":"32-usb_msc_host-library-stm32f4","status":"publish","type":"page","link":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/stm32f4\/komplette-library-liste-stm32f4\/32-usb_msc_host-library-stm32f4\/","title":{"rendered":"32-USB_MSC_HOST-Library (STM32F4)"},"content":{"rendered":"<p><div id=\"nav-below\" class=\"navigation\"><div class=\"nav-previous\"><a href=\"https:\/\/mikrocontroller.bplaced.net\/wordpress\/stm32f4\/komplette-library-liste-stm32f4\/31-usb_cdc-library-stm32f4\/\" title=\"31-USB_CDC-Library (STM32F4)\"><span class=\"meta-nav\">\u2190<\/span> 31-USB_CDC-Library (STM32F4)<\/a><\/div><\/div><!-- #nav-below --><div id=\"nav-below\" class=\"navigation\"><div class=\"nav-next\"><a href=\"https:\/\/mikrocontroller.bplaced.net\/wordpress\/stm32f4\/komplette-library-liste-stm32f4\/33-lcd_ssd1289-library-stm32f4\/\" title=\"33-LCD_SSD1289-Library (STM32F4)\">33-LCD_SSD1289-Library (STM32F4) <span class=\"meta-nav\">&rarr;<\/span><\/a><\/div><\/div><!-- #nav-below --><\/p>\n<p>Mit dieser Library k\u00f6nnen normale USB-Sticks am USB-OTG-Port vom Discovery-Modul betrieben werden. Per FATFS-Library (die USB-Version) kann dann mit Filefunktionen darauf zugegriffen werden.<br \/>\nHinweis : es gibt noch eine Library f\u00fcr SD-Karten per FATFS (<a href=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/?page_id=225\">Nr. 13<\/a>) und eine kombinierte Library SD+USB (<a href=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/?page_id=519\">Nr. 87<\/a>)<\/p>\n<p>Die Library hat nur zwei Funktionen :<br \/>\n1. Eine \u201cInit-Funktion\u201d<br \/>\nDie muss beim start einmal aufgerufen werden.<\/p>\n<p>2. Die \u201cHOST_Do-Funktion\u201d<br \/>\nDiese muss zyklisch, am besten in der while(1) aufgerufen werden. Sie liefert den Status vom Memory-Stick zur\u00fcck. Dieser Status muss ausgewertet werden und erst wenn ein USB-Stick erkannt wurde, darf per FATFS darauf zugegriffen werden.<\/p>\n<p>Hinweis : ich hab hier zwei USB-Sticks ausprobiert. Einmal ein 8GB-Stick von SanDisk. Mit diesem kommt es aber zu einem Fehler -&gt; \u201cDEVICE_NOT_SUPPORTED\u201d. Mit dem zweiten Stick, einem 4GB Intenso kommt kein Fehler und das schreiben und lesen funktioniert ohne Probleme.<\/p>\n<p>Es wird ein USB-Adapter mit Micro-USB-Stecker ben\u00f6tigt. (gibts bei EBay oder Amazon)<\/p>\n<p><strong>Beispielbild :<\/strong><\/p>\n<div id=\"gallery-1\" class=\"gallery galleryid-1333 gallery-columns-3 gallery-size-thumbnail\">\n<dl class=\"gallery-item\">\n<dt class=\"gallery-icon\"><a title=\"ubs_host_msc\" href=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-content\/uploads\/2013\/04\/ubs_host_msc.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-thumbnail\" src=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-content\/uploads\/2013\/04\/ubs_host_msc-150x150.jpg\" alt=\"Daten vom Stick\" width=\"150\" height=\"150\" \/><\/a><\/dt>\n<dd class=\"wp-caption-text gallery-caption\">Daten vom Stick<\/dd>\n<\/dl>\n<dl class=\"gallery-item\">\n<dt class=\"gallery-icon\"><a title=\"usb_msc2\" href=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-content\/uploads\/2013\/04\/usb_msc2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-thumbnail\" src=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-content\/uploads\/2013\/04\/usb_msc2-150x150.jpg\" alt=\"USB-Stick am Discovery Modul\" width=\"150\" height=\"150\" \/><\/a><\/dt>\n<dd class=\"wp-caption-text gallery-caption\">USB-Stick am Discovery Modul<\/dd>\n<\/dl>\n<\/div>\n<p><strong>Benutzte Pins :<\/strong><\/p>\n<pre lang=\"c\" line=\"1\">PA9   -&gt; USB_OTG_VBUS\nPA10  -&gt; USB_OTG_ID\nPA11  -&gt; USB_OTG_DM\nPA12  -&gt; USB_OTG_DP\nPC0   -&gt; USB_VBUS_Enable<\/pre>\n<p><strong>Voraussetzungen :<\/strong><\/p>\n<pre lang=\"c\" line=\"1\">Benutzte Module der CooCox-IDE : GPIO, MISC\nBenutzte Librarys : STM32_UB_FATFS (USB-Version)<\/pre>\n<p><strong>Enumerationen :<\/strong><\/p>\n<pre lang=\"c\" line=\"1\">typedef enum {\n  USB_MSC_HOST_NO_INIT =0,   \/\/ USB-Schnittstelle noch nicht initialisiert\n  USB_MSC_DEV_DETACHED,      \/\/ kein Device angeschlossen\n  USB_MSC_SPEED_ERROR,       \/\/ USB-Speed wird nicht unterst\u00fctzt\n  USB_MSC_DEV_NOT_SUPPORTED, \/\/ Device wird nicht unters\u00fctzt\n  USB_MSC_DEV_WRITE_PROTECT, \/\/ Device ist schreibgesch\u00fctzt\n  USB_MSC_OVER_CURRENT,      \/\/ \u00dcberstrom erkannt\n  USB_MSC_DEV_CONNECTED      \/\/ Device verbunden und bereit\n}USB_MSC_HOST_STATUS_t;<\/pre>\n<p><strong>Funktionen :<\/strong><\/p>\n<pre lang=\"c\" line=\"1\">void UB_USB_MSC_HOST_Init(void);                 \/\/ zum init des USB-Host\nUSB_MSC_HOST_STATUS_t UB_USB_MSC_HOST_Do(void);  \/\/ zum check vom Device-Status<\/pre>\n<p><strong>Beispiel :<\/strong><\/p>\n<pre lang=\"c\" line=\"1\">\/\/--------------------------------------------------------------\n\/\/ File     : main.c\n\/\/ Datum    : 13.04.2013\n\/\/ Version  : 1.0\n\/\/ Autor    : UB\n\/\/ EMail    : mc-4u(@)t-online.de\n\/\/ Web      : www.mikrocontroller-4u.de\n\/\/ CPU      : STM32F4\n\/\/ IDE      : CooCox CoIDE 1.7.0\n\/\/ Module   : CMSIS_BOOT, M4_CMSIS_CORE\n\/\/ Funktion : Demo der USB-MSC-HOST-Library\n\/\/ Hinweis  : Diese zwei Files muessen auf 8MHz stehen\n\/\/              \"cmsis_boot\/stm32f4xx.h\"\n\/\/              \"cmsis_boot\/system_stm32f4xx.c\"\n\/\/--------------------------------------------------------------\n\n#include \"main.h\"\n#include \"stm32_ub_led.h\"\n#include \"stm32_ub_usb_msc_host.h\"\n\nint main(void)\n{\n  FIL myFile;   \/\/ Filehandler\n  uint8_t write_ok=0;\n\n  SystemInit(); \/\/ Quarz Einstellungen aktivieren\n\n  \/\/ Init der LEDs\n  UB_Led_Init();\n\n  \/\/ Init vom USB-OTG-Port als MSC-HOST\n  \/\/ (zum lesen\/schreiben auf einen USB-Stick)\n  UB_USB_MSC_HOST_Init();\n\n  while(1)\n  {\n    \/\/ pollen vom USB-Status\n    if(UB_USB_MSC_HOST_Do()==USB_MSC_DEV_CONNECTED) {\n      \/\/ wenn USB-Stick erkannt wurde\n      UB_Led_On(LED_GREEN);\n\n      \/\/ wenn File noch nicht geschrieben wurde\n      if(write_ok==0) {\n       \twrite_ok=1;\n       \tUB_Led_On(LED_RED);\n       \t\/\/ Media mounten\n       \tif(UB_Fatfs_Mount(USB_0)==FATFS_OK) {\n          \/\/ File zum schreiben im root neu anlegen\n          if(UB_Fatfs_OpenFile(&amp;myFile, \"USB_File.txt\", F_WR_CLEAR)==FATFS_OK) {\n            \/\/ ein paar Textzeilen in das File schreiben\n            UB_Fatfs_WriteString(&amp;myFile,\"Test der WriteString-Funktion\");\n            UB_Fatfs_WriteString(&amp;myFile,\"hier Zeile zwei\");\n            UB_Fatfs_WriteString(&amp;myFile,\"ENDE\");\n            \/\/ File schliessen\n            UB_Fatfs_CloseFile(&amp;myFile);\n          }\n          \/\/ Media unmounten\n          UB_Fatfs_UnMount(USB_0);\n        }\n        UB_Led_Off(LED_RED);\n      }\n    }\n    else {\n      \/\/ wenn kein USB-Stick vorhanden\n      UB_Led_Off(LED_GREEN);\n    }\n  }\n}\n<\/pre>\n<p>Hier die Library zum\u00a0<strong>Download :<\/strong><\/p>\n<p><a href=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-content\/uploads\/2013\/04\/ub_stm32f4_usb_msc_host_v100.zip\">ub_stm32f4_usb_msc_host_v100<\/a><\/p>\n<p>Hier der komplette CooCox-Projektordner zum\u00a0<strong>Download :<\/strong><\/p>\n<p><a href=\"http:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-content\/uploads\/2013\/04\/Demo_32_USB_MSC_HOST.zip\">Demo_32_USB_MSC_HOST<\/a><\/p>\n<h3 id=\"comments-title\">36 Antworten auf <em>32-USB_MSC_HOST-Library (STM32F4)<\/em><\/h3>\n<ol class=\"commentlist\">\n<li id=\"li-comment-1129\" class=\"comment even thread-even depth-1\">\n<div id=\"comment-1129\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/df73a912a72c7febe14a1cfec54dcbaf?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Christian<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">10. Dezember 2013 um 18:05<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hey, der USB stick wird von mir soweit erkannt, das heisst es m\u00fcsste auch alles korrekt initialisiert sein\u2026jedoch bricht bricht mir der usb process immer bei der USBH_HandleEnum ab und weiss einfach nicht warum evtl kannst du mir weiterhelfen.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-1131\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-1131\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">10. Dezember 2013 um 19:53<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>wie ich geschrieben habe, hab ich auch einen Stick der nicht funktioniert. Ich vermute der Code ist nicht ganz Fehlerfrei\u2026aber ich suche da keine Fehler. Versuchs mal mit einem anderen Stick oder im Netz nach einer anderen implementation.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-1324\" class=\"comment even thread-odd thread-alt depth-1\">\n<div id=\"comment-1324\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/e31a0c639ff49c8cf6a6ffb1bf6a0975?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Daniel<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">1. Februar 2014 um 12:35<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hallo, bei mir funktioniert alles einwandfrei und der USB- Stick wird sofort erkannt. Allerdings frage ich mich, wie es m\u00f6glich ist, dass man auf Dateien zugreifen kann, ohne ihren genauen Namen zu wissen. Ich m\u00f6chte zum Beispiel die erste Datei, die auf dem Stick vorhanden ist \u00f6ffnen, um daraus zum Beispiel einen mp3- Player zu realisieren. Ich bin noch ziemlicher Anf\u00e4nger auf dem Gebiet, also w\u00e4re es super wenn mir jemand helfen k\u00f6nnte!<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-1326\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-1326\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">1. Februar 2014 um 14:19<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>ich hab schon einen MP3-Player realisiert : Show-Prj-03. Da kannst du auch nachlesen wie man per \u201cf_readdir()\u201d ein Direktory-Eintrag auslie\u00dft. Oder lie\u00df in der Doku von ChaN nach, da stehen auch Beispiele drinn.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-1329\" class=\"comment even thread-even depth-1\">\n<div id=\"comment-1329\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/e31a0c639ff49c8cf6a6ffb1bf6a0975?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Daniel<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">1. Februar 2014 um 17:49<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Dieses Projekt hatte ich leider noch nicht gesehn. Es wird mir sicher sehr weiterhelfen. Danke!<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<li id=\"li-comment-1709\" class=\"comment odd alt thread-odd thread-alt depth-1\">\n<div id=\"comment-1709\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/6945d1237f7e6e5b3049f55eab97f30d?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Thierry<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">16. Mai 2014 um 11:04<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hello,<br \/>\nVery good code, i tried it with a OBD2 USB device.<br \/>\nBig thanks.<br \/>\nI will come back in few days to write report.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<li id=\"li-comment-2008\" class=\"comment even thread-even depth-1\">\n<div id=\"comment-2008\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/133677fa0a9a2e8d01713011199e0c1c?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Sven<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">5. August 2014 um 16:30<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hi,<br \/>\nich wollte mal nachfragen, was alles beim zusammenf\u00fchren von USB und SDIO zu tun ist?<br \/>\nOder hast du es evtl. schon gemacht und nur vergessen upzudaten?<br \/>\n\u00dcber Hilfe w\u00fcrde ich mich freuen.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-2038\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-2038\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">17. August 2014 um 11:14<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>ich habe den Kombinierten-Mode jetzt fertig : siehe Dual_FATFS-Library (Nr. 87)<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-2477\" class=\"comment even thread-odd thread-alt depth-1\">\n<div id=\"comment-2477\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/e7a291f64b1224fa4f7f6d6896a15d6a?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Emsila<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">17. November 2014 um 14:35<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hello.<br \/>\nI want use USB_CDC and USB_MSC in one program. When press user taster, usb mode change state. How to use usb_cdc and usb_msc at same time?<br \/>\nBest regards,<br \/>\nEI<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-2480\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-2480\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">17. November 2014 um 19:35<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>you need functions to deinit USB_CDC and USB_MSC.<br \/>\n1. USB_MSC deinit<br \/>\n2. USB_CDC init<br \/>\n3. Button<br \/>\n4. USC_CDC deinit<br \/>\n5. USB_MSC init<br \/>\n6. Button<br \/>\n7. GOTO 1<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-2549\" class=\"comment even depth-3\">\n<div id=\"comment-2549\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/e7a291f64b1224fa4f7f6d6896a15d6a?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Emsila<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">24. November 2014 um 15:01<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>OK. Problem is in identical name definition in MSC and CDC header files for functions. usb_bsp.c, usb_core.c. This is not possible a compiling.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<li id=\"li-comment-2550\" class=\"comment odd alt depth-3\">\n<div id=\"comment-2550\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/e7a291f64b1224fa4f7f6d6896a15d6a?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Emsila<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">24. November 2014 um 15:16<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Can you post a project with two modes when blue button (user button on discovery) changes state (cdc or msc) ?<br \/>\nThanks.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-2567\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-4\">\n<div id=\"comment-2567\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">27. November 2014 um 20:19<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>thats very time-consuming\u2026you must do this on your own.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4086\" class=\"comment odd alt thread-even depth-1\">\n<div id=\"comment-4086\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/4cb51f675049481d9c5896d0394c7dab?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Christian<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">21. August 2015 um 11:16<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hallo,<\/p>\n<p>bei mir erkennt das Programm meinen USB Stick nicht. Was kann es da haben? Die gr\u00fcne LED leuchtet.<\/p>\n<p>Danke<\/p>\n<p>bg Christian<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4088\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-2\">\n<div id=\"comment-4088\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">23. August 2015 um 09:46<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>k.A.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4293\" class=\"comment odd alt thread-odd thread-alt depth-1\">\n<div id=\"comment-4293\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/d2d593f3879b1d170cd47057fe3e36d6?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Gary<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">4. November 2015 um 07:57<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hi,<br \/>\nI used Google translate in my post and maybe it\u2019s not so good, so I will write this one in english. Sorry for 2 posts!<\/p>\n<p>By the way, thanks for writing and sharing your code, it makes it easier to help things started.<\/p>\n<p>I have tested your code in my target application with the needed changes and it works OK! This was using your project in Coocox.<br \/>\nHowever, I am using Atollic, and as you know, it\u2019s quite similar to Coocox. I added the directory \u201cub_lib\u201d to my project, and then your test code in my \u201cmain.c\u201d file. However, it doesn\u2019t seem to work. It always returns \u201cUSB_MSC_DEV_DETACHED\u201d.<\/p>\n<p>Why would this work good in Coocox, but not in Atollic? Can you think of anything?<\/p>\n<p>Gary<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4305\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-2\">\n<div id=\"comment-4305\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">6. November 2015 um 21:59<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>could be many things. check these two first :<br \/>\n1. CPU clock (must be 168 MHz and USB @48MHz)<br \/>\n2. Optimization should be : \u201cO0 = none\u201d<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4321\" class=\"comment odd alt thread-even depth-1\">\n<div id=\"comment-4321\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/d2c9c081dd6534b6d809c4925c778570?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Roy<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">12. November 2015 um 00:38<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hi, I\u2019m having a problem, the demo works, I can write in the pen drive. But when I try to use the library in another project the status change to USB_MSC_DEV_DETACHED, could it be because a conflict with another libraries?<br \/>\nI\u2019m using:<br \/>\n#include \u201cstm32_ub_lcd_2x16.h\u201d<br \/>\n#include \u201cstm32f4xx.h\u201d<br \/>\n#include \u201cstm32f4xx_gpio.h\u201d<br \/>\n#include \u201cstm32f4xx_rcc.h\u201d<br \/>\n#include \u201cstm32f4xx_tim.h\u201d<br \/>\n#include \u201cstm32f4xx_usart.h\u201d<br \/>\n#include \u201cmisc.h\u201d<br \/>\n#include \u201cstdio.h\u201d<br \/>\n#include \u201cstm32_ub_keymatrix.h\u201d<br \/>\n#include \u201cstm32_ub_led.h\u201d<br \/>\n#include \u201cstm32_ub_usb_msc_host.h\u201d<\/p>\n<p>Also I\u2019m using a library from the DHT11 sensor that uses USART but anothers ports.<\/p>\n<p>I created a function Copy that contains the code that it\u2019s in the while from the demo (if(UB_USB_MSC_HOST_Do()==USB_MSC_DEV_CONNECTED) { \u2026.)<br \/>\nWhen I need to copy something I call Copy (inside the main).<br \/>\nThe clock it\u2019s at 168MHz<\/p>\n<p>Thanks<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4327\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-2\">\n<div id=\"comment-4327\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">13. November 2015 um 20:20<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>dont add 1000 lines of code and try to find a failure.<br \/>\nMake a running version und add a single new function.<br \/>\nTest the new function (and all old functions) and so on.<br \/>\nThats the only way to handle big projects.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<li id=\"li-comment-4330\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-4330\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">13. November 2015 um 20:31<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>besides\u2026the function \u201cUB_USB_MSC_HOST_Do()\u201d<br \/>\nmust called the whole time<br \/>\nmaybe you must use the Systick to do this<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4373\" class=\"comment even depth-3\">\n<div id=\"comment-4373\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/d2c9c081dd6534b6d809c4925c778570?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Roy<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">23. November 2015 um 16:32<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Yes, after I wrote this I get how it works to see if it\u2019s connected or not.<br \/>\nMy problem now is that it recognizes as connected, but says is unmounted. I guess I\u2019m missing something<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4374\" class=\"comment odd alt depth-4\">\n<div id=\"comment-4374\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/d2c9c081dd6534b6d809c4925c778570?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Roy<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">23. November 2015 um 16:34<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>I mean, only writes once, after that nothing, just connected but not mounted (I read a sensor and save the data, in a loop)<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4378\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-5\">\n<div id=\"comment-4378\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">23. November 2015 um 19:41<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>try this flow :<\/p>\n<pre class=\"brush: plain; title: ; notranslate\">while(1) \n{    \n  if(UB_USB_MSC_HOST_Do()==USB_MSC_DEV_CONNECTED) {\n    if(UB_Fatfs_Mount(USB_0)==FATFS_OK) {          \n      if(UB_Fatfs_OpenFile(&amp;myFile, \"USB_File.txt\", F_WR_CLEAR)==FATFS_OK) {\n        while(UB_USB_MSC_HOST_Do()==USB_MSC_DEV_CONNECTED) {\n          \/\/ 1. read here the data from your sensor\n          \/\/ 2. write here the data to the file (with UB_FatFS_Write)\n          \/\/\n          \/\/ if you want to exit, use \"break\"\n        }\n        UB_Fatfs_CloseFile(&amp;myFile);\n      }\n      UB_Fatfs_UnMount(USB_0);\n    }\n  }\n}\n\n<\/pre>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4323\" class=\"comment odd alt thread-odd thread-alt depth-1\">\n<div id=\"comment-4323\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/8687948a1b128b08751b8c12bf24b0a5?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">TomTom<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">12. November 2015 um 11:49<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Funktioniert aufs erste mal flashen einwandfrei.<br \/>\nHabe ebenfalls einen Intenso USB Stick mit 4GB verwendet.<br \/>\nAdapterkabel gibts g\u00fcnstig bei Amazon oder Ebay.<\/p>\n<p>Wiedermal vielen Dank f\u00fcr deine Seite!<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<li id=\"li-comment-4384\" class=\"comment even thread-even depth-1\">\n<div id=\"comment-4384\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/d2c9c081dd6534b6d809c4925c778570?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Roy<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">25. November 2015 um 01:38<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hi,me again (I cant reply in your answer so I write here)<br \/>\nThe flow you gave works, but, if I need to do something else,and then go back and write data in the stick,99% fails to mount it, it\u2019s like 1st time mounting it works, but 2nd fails (keeps connected, but unmounted). What could be the problem?<\/p>\n<p>Let\u2019s supose in the file I have 5 lines of text, if I need to read line 1,then 2,then3,then 2 again, it\u2019s that posible?<br \/>\nThere\u2019s a f_lseek in ff.h library, should use it?<\/p>\n<p>Thanks!<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4386\" class=\"comment odd alt depth-2\">\n<div id=\"comment-4386\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/d2c9c081dd6534b6d809c4925c778570?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Roy<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">25. November 2015 um 08:10<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>I think I found the problem:<br \/>\nUB_Fatfs_Mount checks f_mount,f_mount checks chk_mounted. 1st time it\u2019s ok, but after that chk_mounted returns FR_NO_FILESYSTEM ( No FAT volume is found).<br \/>\nI changed the return value to FR_OK and now everytime I want to mount the USB, it works, but it shouldn\u2019t be like that, right?<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4388\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-3\">\n<div id=\"comment-4388\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">25. November 2015 um 19:24<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>maybe the drive needs a delay after plugin to be ready.<br \/>\ntry a loop until mount is ok.<br \/>\nand you dont have to mount a allready mounted device.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4389\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-4389\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">25. November 2015 um 19:29<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>yes, with fseek you can skip to a position you want. but you must know<br \/>\nthe position. in the easiest way all lines have the same lenght.<br \/>\nif not, you have to search the \u201ccarriage return\u201d or another special byte.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4390\" class=\"comment even thread-odd thread-alt depth-1\">\n<div id=\"comment-4390\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/3292cb6c7b9a32b4cbdc96e2b17073f0?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Frank Wolk<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">26. November 2015 um 01:01<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hallo,<br \/>\nerstmal danke f\u00fcr Deine Librarys!<br \/>\nIch m\u00f6chte in das Textfile Werte von meinem ADC Wandler hineinschreiben.<br \/>\nAber ich bekomm das einfach nicht hin :\/ K\u00f6nntest Du mir einen Tipp geben?<br \/>\nIch w\u00e4re daf\u00fcr sehr dankbar!!<\/p>\n<p>UB_Fatfs_WriteString(&amp;myFile, ADCWert);<\/p>\n<p>Dazu hab ich versucht die Funktion anzupassen (ohne Erfolg):<\/p>\n<p>FATFS_t UB_Fatfs_WriteString(FIL* fp, int Wert)<br \/>\n{<br \/>\nFATFS_t ret_wert=FATFS_PUTS_ERR;<br \/>\nint check=0;<\/p>\n<p>check=f_puts(wert, fp);<\/p>\n<p>if(check&gt;=0) {<br \/>\nret_wert=FATFS_OK;<br \/>\n\/\/ Zeilenendekennung hinzuf\u00fcgen<br \/>\nf_putc(\u2018\\n\u2019, fp);<br \/>\n}<br \/>\nelse {<br \/>\nret_wert=FATFS_PUTS_ERR;<br \/>\n}<\/p>\n<p>return(ret_wert);<br \/>\n}<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4396\" class=\"comment odd alt depth-2\">\n<div id=\"comment-4396\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/3292cb6c7b9a32b4cbdc96e2b17073f0?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Frank Wolk<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">27. November 2015 um 10:31<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hab es mit der Funktion UB_fatfs_writeblock hinbekommen.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<li id=\"li-comment-4402\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-2\">\n<div id=\"comment-4402\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">28. November 2015 um 11:45<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>wenn es ein Textfile ist, kannst du den Zahlenwert auch<br \/>\nin einen Text wandeln<\/p>\n<pre class=\"brush: plain; title: ; notranslate\">char buf[20];\nsprintf(buf,\"ADC=%d\",wert);\nUB_Fatfs_WriteString(&amp;myFile,buf);\n<\/pre>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4497\" class=\"comment odd alt thread-even depth-1\">\n<div id=\"comment-4497\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/1ca24786181d8e8c779ead82e3ef3e74?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Timo<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">6. Januar 2016 um 13:29<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hi,<br \/>\nerstmal danke f\u00fcr Librarys.<br \/>\nObwohl ich an dem Beispielprogramm nichts ver\u00e4ndert habe, bekomme ich beim builden folgende Fehlermeldung:<\/p>\n<p>\u201c.\\Objects\\testusb.axf: Error: L6200E: Symbol USB_MSC_HOST_STATUS multiply defined (by stm32_ub_usb_msc_host.o and main.o).\u201d<\/p>\n<p>Hast du eine Idee, wie man das Problem l\u00f6sen kann?<br \/>\nDanke im voraus!<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4500\" class=\"comment byuser comment-author-admin_ub bypostauthor even depth-2\">\n<div id=\"comment-4500\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">9. Januar 2016 um 11:11<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>benutzt du was anderes als CooCox oder OpenSTM als IDE ?<br \/>\nfalls ja siehe Antwort unten bei Alex.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4505\" class=\"comment odd alt depth-3\">\n<div id=\"comment-4505\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/1ca24786181d8e8c779ead82e3ef3e74?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Timo<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">10. Januar 2016 um 14:00<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Dankesch\u00f6n, es hat geklappt.<\/p>\n<p>Ja, ich benutze wie Alex Keil<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li id=\"li-comment-4498\" class=\"comment even thread-odd thread-alt depth-1\">\n<div id=\"comment-4498\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/1.gravatar.com\/avatar\/b9d4b851ef305c85b8a72845333576ab?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">Alex<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">6. Januar 2016 um 15:40<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>Hi,<\/p>\n<p>danke f\u00fcr die Library.<br \/>\nDie Hex-Datei funktioniert super, m\u00f6chte ich jedoch das Projekt mit uVision Keil builden bekomme ich den gleichen Fehler wie Timo.<\/p>\n<p>W\u00fcrde mich sehr \u00fcber deine Hilfe freuen.<\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/p>\n<ul class=\"children\">\n<li id=\"li-comment-4501\" class=\"comment byuser comment-author-admin_ub bypostauthor odd alt depth-2\">\n<div id=\"comment-4501\">\n<div class=\"comment-author vcard\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-40 photo\" src=\"http:\/\/0.gravatar.com\/avatar\/67426419ead44d5afa132e92685bb460?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G\" alt=\"\" width=\"40\" height=\"40\" \/><cite class=\"fn\">admin_ub<\/cite> <span class=\"says\">sagt:<\/span><\/div>\n<p><!-- .comment-author .vcard --><\/p>\n<div class=\"comment-meta commentmetadata\">9. Januar 2016 um 11:14<\/div>\n<p><!-- .comment-meta .commentmetadata --><\/p>\n<div class=\"comment-body\">\n<p>vermutlich mag er die initialisierung der Variable \u201cUSB_MSC_HOST_STATUS\u201d im H-File nicht.<br \/>\nverschiebe mal die Zeile<br \/>\n<code><br \/>\nUSB_MSC_HOST_STATUS_t USB_MSC_HOST_STATUS;<br \/>\n<\/code><br \/>\nvon stm32_ub_usb_msc_host.h nach stm32_ub_usb_msc_host.c<br \/>\ncompiliere dann nochmal und f\u00fcge bei allen C-Files die dann eine<br \/>\nfehler zeigen wegen unbekannter variable diese zeile ein :<br \/>\n<code><br \/>\nextern USB_MSC_HOST_STATUS_t USB_MSC_HOST_STATUS;<br \/>\n<\/code><\/p>\n<\/div>\n<\/div>\n<p><!-- #comment-## --><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Mit dieser Library k\u00f6nnen normale USB-Sticks am USB-OTG-Port vom Discovery-Modul betrieben werden. Per FATFS-Library (die USB-Version) kann dann mit Filefunktionen darauf zugegriffen werden. Hinweis : es gibt noch eine Library f\u00fcr SD-Karten per FATFS (Nr. 13) und eine kombinierte Library &hellip; <a href=\"https:\/\/mikrocontroller.bplaced.net\/wordpress\/stm32f4\/komplette-library-liste-stm32f4\/32-usb_msc_host-library-stm32f4\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":144,"menu_order":32,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[128],"tags":[9,158,7,95,186],"class_list":["post-383","page","type-page","status-publish","hentry","category-stm32f4","tag-library","tag-msc","tag-stm32f4","tag-usb","tag-usb-stick"],"_links":{"self":[{"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/pages\/383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/comments?post=383"}],"version-history":[{"count":6,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/pages\/383\/revisions"}],"predecessor-version":[{"id":3032,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/pages\/383\/revisions\/3032"}],"up":[{"embeddable":true,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/pages\/144"}],"wp:attachment":[{"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikrocontroller.bplaced.net\/wordpress\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}