BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - SpicyChef

Pages: [1]
1
Discussion - EVE / Re: why can't I read the Manufacturer/Device ID?
« on: January 25, 2021, 05:42:12 PM »
@Rudolph

Your library helped me understand what I was doing wrong.
I was sending CMD_FLASHDETACH() without the B0 25 78 in the screenshot attached.
Which references [ 302578h REG_CMDB_WRITE  ] in BT817. Doing this is not discussed in the programming manual, so how are programmers supposed to know?


Since I was reading the correct REG_FLASH_STATUS with your library, I decided to copy your code and try it.
I made some adjustments and here is the code I used

Code: [Select]
EVE_cmd_flashdetach();
EVE_cmd_flashspidesel();
uint8_t tx_data[] = {0x90, 0, 0, 0, 0, 0};
EVE_cmd_flashspitx(4, tx_data);
EVE_cmd_flashspirx(0x00, 2);
EVE_cmd_flashspidesel();

Serial.println(EVE_memRead8(0x00));

When I run it. The serial monitor doesn't show anything and It seems like the code is getting stuck at EVE_cmd_flashspirx(). This function keeps doing something and is preventing the rest of the code from executing.
When I comment it out, the rest of the code executes.

2
Discussion - EVE / Re: why can't I read the Manufacturer/Device ID?
« on: January 21, 2021, 02:35:35 PM »
Hello

I took screenshots from a logic analyzer of the following code
Code: [Select]
  delay(100);
  Serial.println(GD.rd(REG_FLASH_STATUS));
  GD.cmd_flashdetach();
  Serial.println(GD.rd(REG_FLASH_STATUS));

In the attachments, GD.rd(REG_FLASH_STATUS).JPG shows the logic when I send   Serial.println(GD.rd(REG_FLASH_STATUS));

and GD.cmd_flashdetach().JPG shows the logic when I send GD.cmd_flashdetach() and Serial.println(GD.rd(REG_FLASH_STATUS)) after that.

I noticed there is some random logic after I send Serial.println(GD.rd(REG_FLASH_STATUS))
The logic analyzer reads B0 81 CC after reading the REG_FLASH_STATUS and I don't know why that is.

Here is the layout of my GD.rd() function
Code: [Select]
byte GDClass::rd(uint32_t addr) {
  return GDTR.rd(addr);
}

Code: [Select]
  byte rd(uint32_t addr)
  {
    __end(); // stop streaming
    __start(addr);
    SPI.transfer(0);  // dummy
    byte r = SPI.transfer(0);
    stream();
    return r;
  }


3
Discussion - EVE / Re: why can't I read the Manufacturer/Device ID?
« on: January 20, 2021, 10:38:44 PM »
The problem is that the flash memory is not getting detached.
I ran the following code to read the status of the flash memory
Code: [Select]
Serial.println(GD.rd(REG_FLASH_STATUS));
  GD.cmd_flashdetach();
  Serial.println(GD.rd(REG_FLASH_STATUS));

The output I'm getting is
2
2

It should be 2 and 1.
2 standing for BASIC and 1 standing for DETACHED

The layout of my cmd_flashdetach command is:
Code: [Select]
void GDClass::cmd_flashdetach() {
  cFFFFFF(0x48);
}

Running cmd_logo for example works and it has the same layout
Code: [Select]
void GDClass::cmd_logo(){
  cFFFFFF(0x31);
}

If I try to run
Code: [Select]
Serial.println(GD.rd(REG_FLASH_STATUS));
  GD.wr(REG_FLASH_STATUS,1);               //writes a byte to REG_FLASH_STATUS
  Serial.println(GD.rd(REG_FLASH_STATUS));
Then the status of the flash memory is correct and the output is as follows
2
1

Can you confirm that this is not an issue? because I tried using different PCBs

Hello,

I believe what you have here is essentially correct:
I tried the following code

 
Code: [Select]
GD.cmd_flashdetach();
  GD.cmd_flashspidesel();
  GD.cmd_flashspitx(4);
  GD.cmd32(0x90);

  GD.cmd_flashspirx(0,2);
  delay(20);
  Serial.println(GD.rd(0));

and
Code: [Select]
Serial.println(GD.rd(0)); is still reading FF or 255

Could you just clarify is GD.cmd32 is writing to RAM_CMD (I believe it does)?
Also does the GD.rd function definitely read from RAM_G?
And could you try calling it with the address bytes also? (GD.cmd32(0x90000000))

Essentially the steps are as follows:
  • Call CMD_FLASHDETACH
  • Call CMD_FLASHSPIDESEL
  • Call CMD_FLAHSSPITX with the number of bytes you want to read
  • Write the desired bytes to be transmitted into RAM_CMD
  • Call CMD_FLASHSPIRX with the location in RAM_G you wish to read the data to, and the number of bytes to be read
  • Read the data from RAM_G

Best Regards,
BRT community

4
Discussion - EVE / Re: why can't I read the Manufacturer/Device ID?
« on: January 20, 2021, 02:21:18 PM »
I have no experience with python. Can you provide code in c? preferably using the Gameduino library

Here is an example code in python to access the registers of flash:
Code: [Select]
def bb(*b):
    return pad4(array.array('B', b).tostring())

def txrx(eve, txpart, n_rx):
    eve.cmd_flashspidesel()
    eve.cmd_flashspitx(len(txpart))
    eve.c(bb(*txpart))
    eve.cmd_flashspirx(0, n_rx)
    if n_rx:
        eve.finish()
        return array.array('B', eve.rdstr(0, n_rx))

def do_sfdp(eve):
    """ Dump the SFDP area in binary """
    eve.cmd_flashdetach()
    eve.cmd_flashspidesel()

    eve.cmd_flashspitx(1)
    eve.c(bb(0x9f))
    eve.cmd_flashspirx(0, 3)
    eve.finish()
    print repr(array.array('B', eve.rdstr(0, 3)).tolist())

5
Discussion - EVE / Re: why can't I read the Manufacturer/Device ID?
« on: January 20, 2021, 02:19:04 PM »
I might be wrong there but I believe there is no way to read any of the registers from the connected flash chip.
Yes, there are the commands CMD_FLASHSPITX and CMD_FLASHSPIRX but there is no way to control the chip-select line.

Well, there is CMD_FLASHSPIDESEL but there is no CMD_FLASHSPISEL.
I could not find anything in the documented registers to control SPIM_SS_N.

So without modifying the hardware (or maybe additional documentation) to allow control over the chip-select line it is only possible to read the content of the attached flash chip thru the flash driver with CMD_FLASHREAD.

I was thinking, CMD_FLASHSPITX and CMD_FLASHSPIRX, automatically drive the CS line low and CMD_FLASHSPIDESEL is used to drive it high, but just like you I couldn't find anything to confirm

6
Discussion - EVE / Re: why can't I read the Manufacturer/Device ID?
« on: January 19, 2021, 05:27:58 PM »
I tried the following code

 
Code: [Select]
GD.cmd_flashdetach();
  GD.cmd_flashspidesel();
  GD.cmd_flashspitx(4);
  GD.cmd32(0x90);

  GD.cmd_flashspirx(0,2);
  delay(20);
  Serial.println(GD.rd(0));

and
Code: [Select]
Serial.println(GD.rd(0)); is still reading FF or 255

7
Discussion - EVE / why can't I read the Manufacturer/Device ID?
« on: January 18, 2021, 09:44:37 PM »
Hello

I have a PCB with BT817 and W25Q128JVSIQ memory chip on it.
I'm trying to read the Manufacturer/Device ID of the memory chip using the command
I used
Code: [Select]
GD.cmd_flashread() to read the Manufacturer/Device ID into RAM_G of BT817 and then used
Code: [Select]
Serial.println(GD.rd(0x00),HEX);
on Arduino but I get FF instead of EF.
Does anyone know what am I doing wrong here?


The memory chip was tested using
Code: [Select]
Serial.println(GD.rd(REG_FLASH_SIZE)); and I get 16M as the size which is correct

Pages: [1]