cmucam3-hardware (#1) - Using mmc_open(), mmc_write() (#232) - Message List

Using mmc_open(), mmc_write()

I am trying to use the mmc_open(), mmc_write() and mmc_close() drivers for accessing my SD card. What do I need to do in my project makefile to allow these drivers to be recognized? I keep getting link errors like: "...undefined reference to 'mmc_open'".

The standard stream I/O drivers work OK (i.e. fopen(), fwrite(), and fclose()). However, there is an issue that I am having with the stream drivers - an extra byte gets inserted every so often. Thus I am trying to go about a different method for performing the I/O to see if the problem still persists.

  • Message #562

    mmc_* functions aren't really exported for use. It is really a bad bug on our side if fwrite is inserting bytes!

    Could you open a ticket for this? It would really help if you could also put some code that triggers this problem.

    Thanks.

    • Message #565

      I stripped things down and the good news is that the problem is not with the MMC drivers! The problem is with the sending of the data to the serial IO port. It appears that whenever there is a binary character with ascii code 0x18 (CANCEL), the character immediately following is duplicated. This even happens when the port is configured with the CC3_UART_BINMODE_TEXT.

      For example, if I send the sequence {0x15, 0x16, 0x17, 0x18, 0x19, 0x1a}, I will observe the following on the terminal:

      0x15 0x16 0x17 0x18 0x19 0x19 0x1a

      So....what am I doing wrong? My code is really quite simple - see below:

      #include <math.h> #include <stdbool.h> #include <stdio.h> #include <time.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <cc3.h> #include <cc3_ilp.h>

      int main (void) {

      uint n;

      // Configure UART for IRIDIUM SatCom? I/O. cc3_uart_init (0, CC3_UART_RATE_57600, CC3_UART_MODE_8N1,

      CC3_UART_BINMODE_BINARY);

      // Set UART0 to be unbuffered I/O. setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdin, NULL, _IONBF, 0);

      // Initialize camera aspects of CMU (even if camera not used). cc3_camera_init();

      // Shut off all the LEDs. cc3_led_set_state (0, false); cc3_led_set_state (1, false); cc3_led_set_state (2, false);

      while (!cc3_button_get_state());

      for (n=0; n<32; n++) putchar(n); for (n=32; n>0; n--) putchar(n-1);

      // Test complete indicator. cc3_led_set_state (0, true); while(1);

      return(0);

      }

    • Message #566

      Finally traced the problem....

      The culprit is the HyperTerm? emulator. I tried a different emulator for capturing the data port, and I no longer get the character duplications. So, I guess I will need to figure out where HyperTerm? sets up it key mappings for treating the CANCEL key special.