Jump to content

Rhab

Members
  • Content Count

    31
  • Joined

  • Last visited

Everything posted by Rhab

  1. Hi guys, i try to connect a SD-Card to my Tiva-C Launchpad using the SD-Card-Boosterpack . But i always get an error: "Failed with rc=6". The Launchpad-Pins i use for my first testing are: PD0: SCLK PD1: CS PD2: MISO PD3: MOSI i use the sd-cardtutorial with little changes: because tm4c has no temprature-sensor i commented // analogReference(INTERNAL1V5);// analogRead(TEMPSENSOR); and i changed ui32_ReadTemp = ((uint32_t)analogRead(TEMPSENSOR)*27069 - 18169625) *10 >> 16; to ui32_ReadTemp = ((uint32_t)millis()); that should lead to usable values... my logfile is called LOG.txt instead of LOG.TXT and i changed the cs pin (#define cs_pin 24) and at pfatfs.cpp i changed the other pins: uint8_t _SCLK = 23; uint8_t _MOSI = 26; uint8_t _MISO = 25; i'm not sure if this works... the last change i made is GPIOPinConfigure(GPIO_PD0_SSI1CLK); GPIOPinConfigure(GPIO_PD1_SSI1FSS); GPIOPinConfigure(GPIO_PD2_SSI1RX); GPIOPinConfigure(GPIO_PD3_SSI1TX); GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 ); after pinMode(PUSH2, INPUT_PULLUP); at the setup()... i know that i get this error after "rc = FatFs.open("LOG.txt");" by "if (rc) die(rc);" any ideas what i do wrong? any suggestions? i'm going to despair of that
  2. By now i use a SD card, or i try to use it. When i started this topic i was thinking about several options to manage a mass storage and because i already had a micro-usb-stick i thought it would be nice to solve it that way.
  3. ok i try to explain it with pictures... this is how my output-signals look like and this is what the qei expexts: (can be found on page 1309 of Tiva
  4. yes and no. i decided to use the clock-direction mode with only one hallsensor, because the signal of both hall-sensors did not fit to what is needed for quadrature-mode (my sensors did not have the state both high, tell me if you need more information...). i get the direction directly from my montor-controler and only need one hallsensor as "clock" because every flank (up and down) is counted, there are two counts per revolution. if you know this it should be no problem to use this mode if this is a good enough resolution... sorry for this late answer it should be possible to monitor two motors because the the EK-TM4C123 has two QEI-moduls. You should use the QEI-Pins to use QEI, so you have no big choice...
  5. No, not for the EK-TM4C123. But there is an ccs-example for DK-TM4C123 and it should be possible to adapt it to EK-TM4C123, but that means much work if you want to adapt it to energia... if someone wants to do this work it should be mentioned that on the EK-TM4C123 the VBUS and ID pin are not connected. You would have to put in resistors. (How this works can be read at the userguide of EX-TM4C123)
  6. This is correct. It is one of the Tiva C series connected launchpads. The cheapest one. http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c123gxl.html#tabs best regars rhab
  7. found my problem signal doesn't fit to what quadrature, so i can't use qei to detect direction... but i can detect velocity and count position with clock_dir...
  8. My cable had a problem, but the code doesn't work... i tested the signals with an oscilloscope, i tested the inversion wir clock-dir-mode, i think the unlocking should work too... In CLOCK_DIR mode i see that position is counted if the magnet passes (2 counts each time) it works with both signals (tested by swapping PhA an PhB). In QUADRATURE mode, the position counter doesn't work. Sometimes it +1 or -1 around the base value but it doesn't count the rotations... I have unlocked PD7 and i think this works... (see clock_dir mode), the inversion works because the direction in clock_dir mode changes if i don't invert.
  9. i think i have a problem with my hardware, found out, that it is possible to change the velocity-value by shaking the cables... so maybe my code works
  10. yes, this are hall-sensors... thanks for your code i can't see huge differences but the order is a bit different, so i'll try some things and maybe i'll have success...
  11. solved my Problem... i forgot myScreen.setFontSolid(true); now it works
  12. Thanks, after you told me what the clock/direction-signal should be, i am sure that i have to use quadrature... i have two signals following each other... the picture shows the QE-sensors and the engine shaft with a magnet....
  13. hi, now i got a new problem. what i want to do is switching between different "screens", which all show different measurement-data (as changing string). If i use only one "screen", there is no problem. But in the moment i draw a button (which should be used to switch "screen") the changing values can't be displayed correct (the value is only white pixel-bulk) here you can see the value 2x (second character is changing in this moment) without button here you can't see any value with button... here is my code(the functionality of the button is not implemented yet, but this shouldn't be a problem...): #include "Energia.h" #include "SPI.h" #include <LCD_graphics.h> #include "LCD_GUI.h" #define K35_SPI; #include "Screen_K35_SPI.h" Screen_K35_SPI myScreen; // Define variables and constants uint16_t value=0; boolean increase=true; uint16_t option=1; // option 1 => Screen 1 // option 2 => Screen 2 // option 3 => ... //Define Buttons button bRight; //button bLeft; void setup() { Serial.begin(9600); Serial.println("begin... "); myScreen.begin(); myScreen.setOrientation(1); myScreen.clear(); //myScreen.dRectangle(myScreen.screenSizeX()-30, 0, 30, myScreen.screenSizeY(), myColours.red); bRight.dStringDefine(&myScreen, myScreen.screenSizeX()-30, 0, 20, 40, ">", myColours.white, myColours.red); bRight.enable(true); bRight.draw(false); } void loop() { switch(option){ case 1: if(value==100){ increase=false; } if(value==0){ increase=true; } myScreen.setFontSize(myScreen.fontMax()); myScreen.gText((myScreen.screenSizeX()-10*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, " ", myColours.black); if(value<10){ myScreen.gText((myScreen.screenSizeX()-10*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, " " + String(value, DEC) , myColours.white); } else if(value<99){ myScreen.gText((myScreen.screenSizeX()-10*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, " " + String(value, DEC) , myColours.white); } else{ myScreen.gText((myScreen.screenSizeX()-10*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, String(value, DEC) , myColours.white); } myScreen.gText((myScreen.screenSizeX()-2*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, "km/h" , myColours.white); if(increase){ value++; } else{ value--; } break; case 2: myScreen.gText((myScreen.screenSizeX()-10*myScreen.fontSizeX())/2, (myScreen.screenSizeY()-myScreen.fontSizeY())/2, "Screen 2!" , myColours.white); break; } }
  14. Hi guys, has anyone tried to use a micro-USB-stick as mass-storage to log measurement-data with EK-TM4C123GXL launchpad? are there any tutorials or maybe at least libs for how to use usb/log data? I would be very happy if anyone could help me.
  15. does this boosterpack work with EK-TM4C123GXL ?
  16. thanks for your hint... i found out that there is a hw_qei.h with: #define QEI_CTL_INVB 0x00000400 // Invert PhB #define QEI_CTL_INVA 0x00000200 // Invert PhA so i included it ( #include "inc/hw_qei.h") i think i have to set this with: HWREG(QEI0_BASE + QEI_O_CTL) |= QEI_CTL_INVA; HWREG(QEI0_BASE + QEI_O_CTL) |= QEI_CTL_INVB; but i'm not sure about it and i'm not sure where to place it... all in all it doesn't work right now i think my sigmode is set correct, but i am not 100% sure, i have two sensors (A and B ) that are placed in an 90
  17. Hi, i want'to use QEI to detect velocity and position of an electric motor. But it doesn't work as suggested. So I hope that anyone has an idea how to solve the problem. The main problem could be that my PhA and PhB Signals are inverted, that means standard-state is 3.3V and pulse-state is 0V. If I understood the TM4C123GH6PM Microcontroller datasheet it is possible to set PhA and PhB on inverted, but i don't understand how this works (Pages 1312-1314). The second thing which i gues that could be wrong is unlocking of PD7 (if i use QEI0), but i have the same problem if i use PC5 and PC6 (QEI1). This is my code: #include <stdint.h> #include <stdbool.h> #include "inc/hw_gpio.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #define PART_TM4C123GH6PM #include "driverlib/pin_map.h" #include "driverlib/qei.h" #include "driverlib/sysctl.h" void config_QEI() { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //Unlock GPIOD7 HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTD_BASE + GPIO_O_CR) |= 0x80; HWREG(GPIO_PORTD_BASE + GPIO_O_AFSEL) &= ~0x80; HWREG(GPIO_PORTD_BASE + GPIO_O_DEN) |= 0x80; HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = 0; // Enable QEI Peripherals SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI0); //Set Pins to be PHA0 and PHB0 GPIOPinConfigure(GPIO_PD6_PHA0); //GPIOPinConfigure(0x00031806); //0x00031806 =>GPIO_PD6_PHA0 GPIOPinConfigure(GPIO_PD7_PHB0); //GPIOPinConfigure(0x00031C06); // 0x00031C06 => GPIO_PD7_PHB0 //Set GPIO pins for QEI GPIOPinTypeQEI(GPIO_PORTD_BASE, (GPIO_PIN_6 | GPIO_PIN_7)); //HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_M; // Configure quadrature encoder, use an arbitrary top limit of 2000 and enable QEI QEIConfigure(QEI0_BASE,(QEI_CONFIG_CAPTURE_A | QEI_CONFIG_NO_RESET | QEI_CONFIG_QUADRATURE | QEI_CONFIG_NO_SWAP), 2000); QEIEnable(QEI0_BASE); //Set position to a middle value QEIPositionSet(QEI0_BASE, 1000); //Configure and enable velocity QEIVelocityConfigure(QEI0_BASE, QEI_VELDIV_1, SysCtlClockGet()); // Divide by clock speed to get counts/sec QEIVelocityEnable(QEI0_BASE); } void setup() { config_QEI(); Serial.begin(9600); Serial.println("Start:"); Serial.println("--------"); } void loop() { uint32_t velocity, position; int32_t rotatingdirection; position = QEIPositionGet(QEI0_BASE); velocity = QEIVelocityGet(QEI0_BASE); rotatingdirection = QEIDirectionGet(QEI0_BASE); Serial.println(position); Serial.println(velocity); Serial.println(rotatingdirection); Serial.println("--------"); delay(1000); } any ideas? Edit: i forgot to tell you what doesn't work. the position isn't chainging and the direction doesn't work correct. i can't measure if the velocity is correct at the moment, but it seems to be correct... Edit2: is there any possibility to test my unlock-code?
  18. ok if i use GPIOPinConfigure(0x00031806); // 0x00031806 =>GPIO_PD6_PHA0 GPIOPinConfigure(0x00031C06); // 0x00031C06 => GPIO_PD7_PHB0 it works... But is there any possibility to use automapping?
  19. you're right... and not only the ti-datasheet, but also the manufacturer-datasheet too...
  20. After installing a few libraries with examples on my laptop (fedora 20 / linux) everything worked perfectly while using my 23" screen but without this large screen i couldn't start energia. When starting energia via terminal (./energia) i got java exceptions: Exception in thread "main" java.lang.IllegalArgumentException: scrollCount and interval must be greater than 0 at processing.app.tools.MenuScroller.<init>(MenuScroller.java:310) at processing.app.tools.MenuScroller.<init>(MenuScroller.java:283) at processing.app.tools.MenuScroller.setScrollerFor(MenuScroller.java:166) at processing.app.Editor.rebuildExamplesMenu(Editor.java:632) at processing.app.Editor.buildFileMenu(Editor.java:513) at processing.app.Editor.buildMenuBar(Editor.java:475) at processing.app.Editor.<init>(Editor.java:206) at processing.app.Base.handleOpen(Base.java:775) at processing.app.Base.handleOpen(Base.java:740) at processing.app.Base.handleNew(Base.java:591) at processing.app.Base.<init>(Base.java:328) at processing.app.Base.main(Base.java:204) ABRT problem creation: 'success' but i could solve this problem and hope that i can help some guys with this small workaround: The problem is, that the Example-Menu is too big for the screen... so i deleted all the Examples-Directories in the new libraries and everything worked fine. I'm pretty new here, but i didn't find this problem here so i hope this post is at the right place.
  21. Thank you very very much. Now my Display works as it should work.
  22. Hi, i'm trying tu use a qei too, but i always get errors like error: 'GPIO_PD6_PHA0' was not declared in this scope also with the code-example above... can someone tell me what i'am doing wrong? i think GPIO_PD6_PHA0 is declared in pin_map.h ... i am using EK-TM4C123GXL
  23. II'm not sure about pin 24. I'm going to remove R10, i'll tell you if it works or not.
  24. this leads to compilation error: LCD_protocol_Terminal_test.cpp:125:16: error: cannot declare variable 'myScreen' to be of abstract type 'Screen_K35_SPI' Screen_K35_SPI myScreen; ^ In file included from LCD_protocol_Terminal_test.cpp:124:0: /home/patrick/sketchbook/libraries/LCD_screen/Screen_K35_SPI.h:76:7: note: because the following virtual functions are pure within 'Screen_K35_SPI': class Screen_K35_SPI : public LCD_screen_font { ^ In file included from /home/patrick/sketchbook/libraries/LCD_screen/Screen_K35_SPI.h:62:0, from LCD_protocol_Terminal_test.cpp:124: /home/patrick/sketchbook/libraries/LCD_screen/LCD_screen_font.h:545:18: note: virtual void LCD_screen_font::_getRawTouch(uint16_t&, uint16_t&, uint16_t&) virtual void _getRawTouch(uint16_t &x0, uint16_t &y0, uint16_t &z0) =0; // compulsory ^ comment virtual void LCD_screen_font::_getRawTouch(uint16_t&, uint16_t&, uint16_t&) leads to /home/patrick/sketchbook/libraries/LCD_screen/Screen_K35_SPI.cpp: In member function 'virtual void Screen_K35_SPI::begin()': /home/patrick/sketchbook/libraries/LCD_screen/Screen_K35_SPI.cpp:292:28: error: '_getRawTouch' was not declared in this scope _getRawTouch(x0, y0, z0); ^ /home/patrick/sketchbook/libraries/LCD_screen/Screen_K35_SPI.cpp: At global scope: /home/patrick/sketchbook/libraries/LCD_screen/Screen_K35_SPI.cpp:519:75: error: no 'void Screen_K35_SPI::_getRawTouch(uint16_t&, uint16_t&, uint16_t&)' member function declared in class 'Screen_K35_SPI' void Screen_K35_SPI::_getRawTouch(uint16_t &x0, uint16_t &y0, uint16_t &z0) and so on, thats why i tried another way... i changed "#define TOUCH_YP 24" to "#define TOUCH_YP 25" , compilation was no problem but i had again a white screen... so i went through all the errors and commented every getRawTouch... and it seems to work, but now the screen is flickering in multi-coulours before beeing white again... is this what i should see?
  25. Thanks. If i want to use touch, option 2 is not possible, but i want to try if it works before "destroying" my hardware... but i don't now what to comment... the function void Screen_K35_SPI::_getRawTouch(uint16_t &x0, uint16_t &y0, uint16_t &z0) has no content i think...
×
×
  • Create New...