BV4622 with NewSerial library

Hi,

I am here making support for BV4622 to arduino.
http://byvac.com/in_sd.php
My I2C effort was futile sor far so I started to test with serial.
I have Arduino duemilanove and I am using NewSerial library.
Problem is now that I don't get right bytes from BV4622.
When SD card is inserted it should output "mnt*" and now I get bytes
255,240,254,232 ... I am totally lost now.

Initialistation

void setup()
{
 debug.begin(9600);
 debug.println("Hello");
  
 bv4622.begin(9600);

and the simple loop I am reading is

void loop()
{
  
  if(bv4622.available())
  {
  debug.println(bv4622.read(),DEC);
  delay(200);
  }
  
}

It must be something simple I am missing. Hopefully someone can give me pointers.

Best Regards
Kari

From page 6 (section 8) of the datasheet:

By default the
Baud rate is 115200 and this can be adjusted
from 2400 to 2000000 (2 million) by sending
the 'baud' command.

That's not the baud rate you are using.

I'd suggest trying the default baud rate.

Thanks,

indeed I thought also about the baud rate. And because I was testing at the Arduino Duemilanove with soft serial. I transferred to mega and now I have basic stuff (open, close, save) working. I will now try to test the text and binary saving to files. After I have this test program working on mega I will retest with duemilanove. I have a feeling that those sys and mount messages work only correctly when baud is 115200. But this I have to verify and ask from Byvac.

I have to rethink whether there is a need for a library for BV4622. It is pretty simple to use without one. As far as there is an example program.

Best Regards
Kari

After I have this test program working on mega I will retest with duemilanove. I have a feeling that those sys and mount messages work only correctly when baud is 115200.

The documentation does say you can use different baud rates, but it doesn't say how to change the baud rate before you successfully connect to it at 115200. After that, there hardly seems like a need to change the rate.

I have to rethink whether there is a need for a library for BV4622. It is pretty simple to use without one.

Nothing's easy the first time. A library might not be needed, but a playground page with a sample program would be nice.

[edit]I went back to the link you posted. There is a user guide linked there, too. The user guide has details for using the device with a PIC. It ways that the device, when the card is inserted, looks for a file on the card called auto.txt, and that the file should sontain 3 lines. One of the lines changes the baud rate. This happens before the PIC even tries to talk to the device.

It would be interesting to know whether this happens only for a connection to a PIC or any time the device sees a new card.[/edit]

Hi PaulS,

I went back to the link you posted. There is a user guide linked there, too. The user guide has details for using the device with a PIC. It ways that the device, when the card is inserted, looks for a file on the card called auto.txt, and that the file should sontain 3 lines. One of the lines changes the baud rate. This happens before the PIC even tries to talk to the device.

It would be interesting to know whether this happens only for a connection to a PIC or any time the device sees a new card.

I tested now and it seems to run the settings made in aut.txt every time card is inserted. At least the baud rate changed when I tested with two cards. One having baud 38400 and other 9600.

This BV4622 is very versatile SD subsystem. It contains a lot of functionality. I am right now testing it with BV513 from Byvac.
It is going to take me some days still. But everything I write will be public domain or GPL. I plan to support Arduino and BV513. I also have 8051 baord but I think I leave that out.

I am beginner on these microcontroller stuff. So I have a question.
How AVR and ATmega (which arduino uses) relate? I probably find that with Google....

Best Regards
Kari