B4R Question SD card CSD register change bits (TMP_WRITE_PROTECT)

roby128128

Member
Hello and thanks for the help I need to change the bit of write protection on SD card, I am in possession of Arduino one R3 with Artmega 328p, as per photo and SD reader, I found a Sketch that should do this thing but I can not connect the library. Hello and thanks for the help I need to change the bit of write protection on SD card, I am in possession of Arduino one R3 with Artmega 328p, as per photo and SD reader, I found a Sketch that should do this thing but I can not connect the library. Hello and thanks for the help I need to change the bit of write protection on SD card, I am in possession of Arduino one R3 with Artmega 328p, as per photo and SD reader, I found a Sketch that should do this thing but I can not connect the library. Could you help me to make a Sketch from B4R. Thank you.
sdcard.jpeg
R3B.jpg
 

Attachments

  • sdcard.jpeg
    sdcard.jpeg
    49.2 KB · Views: 22
  • R3B.jpg
    R3B.jpg
    82.1 KB · Views: 24

KMatle

Expert
Licensed User
Longtime User
but I can not connect the library

You can use the sub's of the sketch as Inline code and call them from B4R. Quite easy. The lib is included via the sketch code. No need to call the lib via B4R.

Copy the code of the setup and void subs to another Inline sub (like "StartSDCard" or similar and call it once from B4R)
 
Upvote 0

roby128128

Member
Thanks KMatle, I found the attached sketch as an example SD-CardLoker , but I can't understand how it works, In any case thanks again for the help.
SD-Lock:
m_csd.v1.tmp_write_protect = 0; // SET TMP OFF
m_csd.v2.tmp_write_protect = 0; // SET TMP OFF
sd.card()->writeCSD(&m_csd); // SAVE CSD DATA!
 
Upvote 0

candide

Active Member
Licensed User
normally with this hard configuration, SD-Locker_v2 arduino project should work.
if you want only a tool to lock/unlock a SD, this project is enough, no need B4R .

if you want to add this feature at a B4R project it is different, but you have to define what you want to use from original project : leds to give status ? pin to indicate feature you want to run ? or just the feature to lock/unlock and PWD change.
 

Attachments

  • sdlocker2-1.pdf
    19.1 KB · Views: 27
Upvote 0

roby128128

Member
Thanks for the answer, now I try to make the board, but I do not understand if it is enough just to build the board, if a part of software for arduino must also be inserted. Thanks always for the help as soon as I finish composing the plate I tell you the result.
 
Upvote 0

roby128128

Member
Thanks to all of you for the help, I solved as per attached image and Sketch sd-cardlocker_v2, I installed the sdfs libraries, everything works. Thanks again
sd4.jpg
 
Upvote 0
Top