2 Replies Latest reply on Sep 14, 2018 12:08 AM by macac_3614686

    S6J329C error when writing to PPC_PCFGR registers

      Hello,

       

      I work for a company which produces its own universal in-system programmers.

      I have already written a small software in order to program both TCFLASH and WORK FLASH for traveo s6j3200 devices, now I have to had to this software the ability to program an hyperflash memory connected to the hyperbus (ch #2 in this case). In order to do so I am merging part of your example project referred to the hyperflash programming but I am facing some issues. When I am configuring the ports as signals for the hyperbus, I get a device reset when writing to the PPC_PCFGR register related to any of the ports.

      I am initializing an stc_port_pin_config_t object and passing it to the Port_SetPinConfig function as in your example. Then I get the error when PORT_WPREG_PPC(punPcfgrn[u32PcfgrnIndex], unPortSetting); is called. If i remove the register assignment inside this macro, I don't get any error.

       

      Is there some initialization to be done in order to prevent errors when writing those registers?

       

      Writing to GPIO registers doesn't give me an error.

       

      Best Regards.

       

      An update to my situation:

      I saw that gcc was not compacting the structure for the PPC register, so I got 0x800 as offset for PPC_KEYCDR register. I fixed this issue by putting the directive __attribute__((aligned(1),packed)) for the involved structs and unions. However, this haven't solved my issue.

      Even if I write this code instead of using the defined macro, I get an error:

        IRQ_DISABLE_LOCAL();

        *(uint32_t*)0xB4740400 = 0x10000014;

        *(uint32_t*)0xB4740400 = 0x50000014;

        *(uint32_t*)0xB4740400 = 0x90000014;

        *(uint32_t*)0xB4740400 = 0xD0000014;

        *(uint16_t*)0xB4740014 = unPortSetting.u16Register;

        IRQ_RESTORE();

       

      This should set the port number 10. I checked the sizes of the assignments in the macro and they seem fine, also the addresses seem fine.

       

      Any hint?